@@ -606,7 +606,17 @@ in {
606606 Neither the root account nor any wheel user has a password or SSH authorized key.
607607 You must set one to prevent being locked out of your system.'';
608608 }
609− ];
609+ ] ++ flip mapAttrsToList cfg.users (name: user:
610+ {
611+ assertion = (user.hashedPassword != null)
612+ -> (builtins.match ".*:.*" user.hashedPassword == null);
613+ message = ''
614+ The password hash of user "${name}" contains a ":" character.
615+ This is invalid and would break the login system because the fields
616+ of /etc/shadow (file where hashes are stored) are colon-separated.
617+ Please check the value of option `users.users."${name}".hashedPassword`.'';
618+ }
619+ );
610620
611621 warnings =
612622 builtins.filter (x: x != null) (