summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-03 12:19:25 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-03 12:32:32 +0100
commitf8f787b800dce2a2402a0cb693e9fe0b6895c4a7 (patch)
treef2b6ca50f062cbc1052b8afa4e65624951bac7a2 /nixos
parent3696536115881e97e90c7ab0581cf2e9b0b20bad (diff)
downloadnixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar.gz
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar.bz2
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar.lz
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar.xz
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.tar.zst
nixlib-f8f787b800dce2a2402a0cb693e9fe0b6895c4a7.zip
Handle initialPassword and initialHashedPassword for !mutableUsers
In this case, they're equivalent to setting ‘password’ and
‘hashedPassword’ (since there is no distinction between an initial and
non-initial user account state).
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/users-groups.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index 43c927cb7692..60906d48ff0c 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -235,6 +235,14 @@ let
           useDefaultShell = mkDefault true;
           isSystemUser = mkDefault false;
         })
+        # If !mutableUsers, setting ‘initialPassword’ is equivalent to
+        # setting ‘password’ (and similarly for hashed passwords).
+        (mkIf (!cfg.mutableUsers && config.initialPassword != null) {
+          password = mkDefault config.initialPassword;
+        })
+        (mkIf (!cfg.mutableUsers && config.initialHashedPassword != null) {
+          hashedPassword = mkDefault config.initialHashedPassword;
+        })
       ];
 
   };