about summary refs log tree commit diff
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2020-06-21 15:28:54 +0200
committerAlyssa Ross <hi@alyssa.is>2020-07-13 23:47:43 +0000
commitabb58fdc282a79f313144e11489d4e0aee960d23 (patch)
tree4a269d24eb5095b5241d1798b8edd47e9ed50604
parent92c980fdae4922d334ae1eccfa1d81dfce0b37b8 (diff)
downloadnixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar.gz
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar.bz2
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar.lz
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar.xz
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.tar.zst
nixlib-abb58fdc282a79f313144e11489d4e0aee960d23.zip
nixos/users-groups: remove ancient security.initialRootPassword option
This option has been deprecated for a long time because is redundant
(users.users.root.initialHashedPassword exists).
Moreover, being of type string, it required to handle the special value
"!" separately, instead of using just `null`.

(cherry picked from commit a6ed7d4845f1142f36b2c461d5a721bc68eb7d48)
-rw-r--r--nixpkgs/nixos/modules/config/users-groups.nix17
1 files changed, 7 insertions, 10 deletions
diff --git a/nixpkgs/nixos/modules/config/users-groups.nix b/nixpkgs/nixos/modules/config/users-groups.nix
index 8defa86818ab..d9261e16773d 100644
--- a/nixpkgs/nixos/modules/config/users-groups.nix
+++ b/nixpkgs/nixos/modules/config/users-groups.nix
@@ -406,6 +406,12 @@ in {
   imports = [
     (mkAliasOptionModule [ "users" "extraUsers" ] [ "users" "users" ])
     (mkAliasOptionModule [ "users" "extraGroups" ] [ "users" "groups" ])
+    (mkChangedOptionModule
+      [ "security" "initialRootPassword" ]
+      [ "users" "users" "root" "initialHashedPassword" ]
+      (cfg: if cfg.security.initialHashedPassword == "!"
+            then null
+            else cfg.security.initialHashedPassword))
   ];
 
   ###### interface
@@ -477,14 +483,6 @@ in {
       '';
     };
 
-    # FIXME: obsolete - will remove.
-    security.initialRootPassword = mkOption {
-      type = types.str;
-      default = "!";
-      example = "";
-      visible = false;
-    };
-
   };
 
 
@@ -499,7 +497,6 @@ in {
         home = "/root";
         shell = mkDefault cfg.defaultUserShell;
         group = "root";
-        initialHashedPassword = mkDefault config.security.initialRootPassword;
       };
       nobody = {
         uid = ids.uids.nobody;
@@ -588,7 +585,7 @@ in {
              || cfg.group == "wheel"
              || elem "wheel" cfg.extraGroups)
             &&
-            ((cfg.hashedPassword != null && cfg.hashedPassword != "!")
+            (cfg.hashedPassword != null
              || cfg.password != null
              || cfg.passwordFile != null
              || cfg.openssh.authorizedKeys.keys != []