modules/other/users.nix: add user options

This commit is contained in:
Bloxx12 2025-04-09 14:46:33 +02:00
commit d3b1ea15aa
2 changed files with 50 additions and 52 deletions

View file

@ -1,35 +0,0 @@
{
config,
lib,
...
}: let
inherit (builtins) elemAt;
inherit (lib) options types;
inherit (options) mkOption;
inherit (types) listOf str;
in {
options.meta = {
users = mkOption {
type = listOf str;
default = ["cr"];
description = ''
A list of users on a system.
'';
};
mainUser = {
username = mkOption {
type = str;
default = elemAt config.meta.users 0;
description = ''
The main user for each system. This is the first element of the list of users by default.
'';
};
gitSigningKey = mkOption {
type = str;
description = ''
The main user's git signing key, used to automatically sing git commits with this key
'';
};
};
};
}

View file

@ -1,11 +1,43 @@
{ {
config, config,
lib,
pkgs, pkgs,
self, self,
... ...
}: let }: let
inherit (builtins) elemAt;
inherit (lib.options) mkOption;
inherit (lib.types) listOf str;
inherit (config.meta.mainUser) username; inherit (config.meta.mainUser) username;
in { in {
options.meta = {
users = mkOption {
type = listOf str;
default = ["cr"];
description = ''
A list of users on a system.
'';
};
mainUser = {
username = mkOption {
type = str;
default = elemAt config.meta.users 0;
description = ''
The main user for each system. This is the first element of the list of users by default.
'';
};
gitSigningKey = mkOption {
type = str;
description = ''
The main user's git signing key, used to automatically sing git commits with this key
'';
default = ''
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw== '';
};
};
};
config = {
users = { users = {
mutableUsers = true; mutableUsers = true;
users = { users = {
@ -26,4 +58,5 @@ in {
# root.hashedPasswordFile = "/persist/passwords/root"; # root.hashedPasswordFile = "/persist/passwords/root";
}; };
}; };
};
} }