diff options
author | zimbatm <zimbatm@zimbatm.com> | 2016-06-12 20:03:14 +0100 |
---|---|---|
committer | zimbatm <zimbatm@zimbatm.com> | 2016-06-12 20:35:34 +0100 |
commit | 2974b6f4c8224ab1097e9386d6b3a0d570f95531 (patch) | |
tree | 5e096917408ec3b8099685c0db35fa372914d01e /nixos/modules/config/users-groups.nix | |
parent | e2413ad5a8b6a80e5552306518fdf16e68b6c6d7 (diff) |
Use shell packages to select the user's shell
The string type is still available for backward-compatiblity.
Diffstat (limited to 'nixos/modules/config/users-groups.nix')
-rw-r--r-- | nixos/modules/config/users-groups.nix | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index e643b2d059b5..95b3e3ca1857 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -1,9 +1,8 @@ -{ config, lib, pkgs, ... }: +{ config, lib, utils, pkgs, ... }: with lib; let - ids = config.ids; cfg = config.users; @@ -103,7 +102,7 @@ let }; home = mkOption { - type = types.str; + type = types.path; default = "/var/empty"; description = "The user's home directory."; }; @@ -118,8 +117,10 @@ let }; shell = mkOption { - type = types.str; - default = "/run/current-system/sw/bin/nologin"; + type = types.either types.shellPackage types.path; + default = pkgs.nologin; + defaultText = "pkgs.nologin"; + example = literalExample "pkgs.bashInteractive"; description = "The path to the user's shell."; }; @@ -359,11 +360,12 @@ let spec = pkgs.writeText "users-groups.json" (builtins.toJSON { inherit (cfg) mutableUsers; - users = mapAttrsToList (n: u: + users = mapAttrsToList (_: u: { inherit (u) - name uid group description home shell createHome isSystemUser + name uid group description home createHome isSystemUser password passwordFile hashedPassword initialPassword initialHashedPassword; + shell = utils.toShellPath u.shell; }) cfg.users; groups = mapAttrsToList (n: g: { inherit (g) name gid; @@ -373,6 +375,12 @@ let }) cfg.groups; }); + systemShells = + let + shells = mapAttrsToList (_: u: u.shell) cfg.users; + in + filter types.shellPackage.check shells; + in { ###### interface @@ -478,6 +486,9 @@ in { }; }; + # Install all the user shells + environment.systemPackages = systemShells; + users.groups = { root.gid = ids.gids.root; wheel.gid = ids.gids.wheel; |