dotfiles/modules/nixos/user/default.nix

61 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2023-03-12 03:59:11 +00:00
{
options,
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.aa.user;
in {
options.aa.user = with types; {
name = mkOption {
type = str;
default = "alejandro";
description = "The name to use for the user account.";
};
2023-03-19 15:46:23 +00:00
fullName = mkOption {
type = str;
default = "Alejandro Angulo";
description = "The full name of the user.";
};
email = mkOption {
type = str;
default = "iam@alejandr0angul0.dev";
description = "The email of the user.";
};
2023-03-12 03:59:11 +00:00
extraGroups = mkOption {
type = listOf str;
default = ["video" "networkmanager"];
2023-03-12 03:59:11 +00:00
description = "Groups to for the user to be assigned.";
};
extraOptions = mkOption {
type = attrs;
default = {};
description = "Extra options passed to <option>users.users.<name></option>.";
2023-03-12 03:59:11 +00:00
};
};
config = {
2023-04-07 03:12:43 +00:00
# Required when setting shell to zsh
# There is a separate module that configures zsh for make
# Refer to modules/tools/zsh/default.nix
programs.zsh.enable = true;
2023-03-12 03:59:11 +00:00
users.users.${cfg.name} =
{
isNormalUser = true;
inherit (cfg) name;
2023-03-12 18:14:43 +00:00
home = "/home/${cfg.name}";
2023-03-12 03:59:11 +00:00
group = "users";
shell = pkgs.zsh;
extraGroups = ["wheel"] ++ cfg.extraGroups;
}
// cfg.extraOptions;
};
}