aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/us/users/module.nix
diff options
context:
space:
mode:
authorSoispha Peetz <soispha@b-peetz.de>2026-10-31 10:26:36 +0100
committerSoispha Peetz <soispha@b-peetz.de>2026-11-27 00:28:58 +0100
commit0741b725fd42a459ced264494284643efadf391a (patch)
tree49abad654750b3b3717735a6b36f2cda98894599 /modules/by-name/us/users/module.nix
parentmodules/openssh: Default enable to true (diff)
downloadnixos-server-0741b725fd42a459ced264494284643efadf391a.zip
{modules/users,common/vhack}: Don't define users in user module
This change also switches the default shell to fish. That should work, and make the shell a litter more useful.
Diffstat (limited to '')
-rw-r--r--modules/by-name/us/users/module.nix84
1 files changed, 45 insertions, 39 deletions
diff --git a/modules/by-name/us/users/module.nix b/modules/by-name/us/users/module.nix
index e029130..0f84b58 100644
--- a/modules/by-name/us/users/module.nix
+++ b/modules/by-name/us/users/module.nix
@@ -8,19 +8,17 @@
mkUser = {
name,
- password,
+ hashedPassword,
uid,
sshKey,
}: {
inherit name;
value = {
- inherit name uid;
+ inherit name uid hashedPassword;
isNormalUser = true;
+ createHome = true;
home = "/home/${name}";
- hashedPassword = password;
- extraGroups = [
- "wheel"
- ];
+ extraGroups = cfg.groups ++ lib.optional cfg.enableDeprecatedPlugdev "plugdev";
openssh.authorizedKeys.keys = [
sshKey
];
@@ -28,30 +26,56 @@
};
extraUsers = lib.listToAttrs (
- builtins.map mkUser [
- {
- name = "soispha";
- password = "$y$jFT$3.8XmUyukZvpExMUxDZkI.$IVrJgm8ysNDF/0vDD2kF6w73ozXgr1LMVRNN4Bq7pv1";
- sshKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIME4ZVa+IoZf6T3U08JG93i6QIAJ4amm7mkBzO14JSkz cardno:000F_18F83532";
- uid = 1000;
- }
- {
- name = "jaki";
- password = "$y$jFT$KpFnahVCE9JbE.5P3us8o.$ZzSxCusWqe3sL7b6DLgOXNNUf114tiiptM6T8lDxtKC";
- sshKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILn7Oumr5IYtTTIKRFvDnofGXXiDLBQE9jVF+7UE+4G5 vhack.eu";
- uid = 1001;
- }
- ]
+ builtins.map mkUser cfg.users
);
in {
options.vhack.users = {
enable = lib.mkEnableOption "user setup";
+ users = lib.mkOption {
+ type = lib.types.listOf (lib.types.submodule {
+ options = {
+ name = lib.mkOption {
+ type = lib.types.str;
+ description = "User name";
+ };
+
+ groups = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = ["wheel"];
+ description = "The groups the user should be part of";
+ };
+
+ # Although deprecated, this helps with old udev rules, that still use this group.
+ # TODO: Try to find a way to remove this option (i.e. set it always to false).
+ enableDeprecatedPlugdev = lib.mkEnableOption "the deprecated plugdev group for the user";
+
+ hashedPassword = lib.mkOption {
+ type = lib.types.str;
+ description = "Hashed user password.";
+ };
+ sshKey = lib.mkOption {
+ type = lib.types.str;
+ description = "public ssh key, for ssh access.";
+ };
+ uid = lib.mkOption {
+ type = lib.types.int;
+ description = "UNIQUE user id, ideally greater than 1000.";
+ };
+ };
+ });
+ description = "Users";
+ };
};
config = lib.mkIf cfg.enable {
+ programs.fish = {
+ enable = true;
+ useBabelfish = true;
+ };
+
users = {
mutableUsers = false;
- defaultUserShell = pkgs.bashInteractive;
+ defaultUserShell = config.programs.fish.package;
users =
{
@@ -61,24 +85,6 @@ in {
};
}
// extraUsers;
-
- # TODO(@bpeetz): Is this still relevant?
- # If it is, it should be moved to a separate module. <2024-12-24>
- # nixremote = {
- # name = "nixremote";
- # isNormalUser = true;
- # createHome = true;
- # home = "/home/nixremote";
- # uid = 1003;
- # group = "nixremote";
- # openssh.authorizedKeys.keys = [
- # "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCbSWqFzb+WTq2JVoRGoTkCkP7AM3bNY91bsUBeoQQc8gKAWuqCrpAOmr2Q2QMaTTGEOM0CsWfWLs3ZYtynHmc7wIFc4T/sUloV+dB9oSCmOk5ePxtj8+gpPK35Ja+ug5zmXsaI4s+n9mEbuuEjn33MxDYCUzAI+aWvWe68u/j+FM3u9c3Ta009rotajjSZ/cmIltgNLsG1rnAZRpwmLVg5UL4cb9um54o/NLYFd2KAekQFVbwUQDzzqriZhWmzkfhnznBMDblf9R1xvZ18Lqv3JF21shdaR43NW1wtuntBvAdsVYK2VUEbj+3MxTkK0aQ/E9SHMtH8MRE4oxU74TeTWfIhuSZk9/wekzSNMkHP3ReFC6B9xCMYa+ZqaTaGSWLQi78AQDeM2F9rAfp3hQzyRa7T7qKlgbae/hEb07xZglqmG7eml9vPSt4AHv5Y176Q95NiiWduGoLQOmjvSBMU9/KEGrGKyLfGH1Wa2EOfPxKKcvcHW0Xi9PlPiuP0nYk= root@thinklappi"
- # ];
- # };
- # };
- # groups.nixremote = {
- # gid = 1004;
- # };
};
};
}