46 lines
899 B
Nix
46 lines
899 B
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
pkgs,
|
||
|
inputs,
|
||
|
...
|
||
|
}:
|
||
|
let
|
||
|
inherit (lib) types;
|
||
|
genUsers = users: f: builtins.listToAttrs (map (user: {
|
||
|
name = user;
|
||
|
value = (f user);
|
||
|
}) users);
|
||
|
in {
|
||
|
options.gg.users = {
|
||
|
admins = lib.mkOption {
|
||
|
type = (types.listOf types.str);
|
||
|
default = [ "mtxyz" "hive" ];
|
||
|
};
|
||
|
friend = lib.mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = {
|
||
|
# Users
|
||
|
programs.fish.enable = true;
|
||
|
users.defaultUserShell = pkgs.fish;
|
||
|
|
||
|
users.users = (genUsers config.gg.users.admins (name: {
|
||
|
isNormalUser = true;
|
||
|
extraGroups = [ "wheel" ];
|
||
|
openssh.authorizedKeys.keyFiles = [
|
||
|
"${inputs.self}/pubkeys/${name}.keys"
|
||
|
];
|
||
|
initialPassword = "";
|
||
|
})) // {
|
||
|
friends = lib.mkIf config.gg.users.friend {
|
||
|
isNormalUser = true;
|
||
|
initialPassword = "";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|