mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
modules.user: check that at least one of hashedPasswordFile or hashedPassword is set
This commit is contained in:
@@ -114,6 +114,17 @@ inputs:
|
||||
(builtins.filter (user: hashedPasswordExist user) user.users));
|
||||
}
|
||||
)
|
||||
# assert at least hashedPasswordFile or hashedPassword is set
|
||||
{
|
||||
assertions = builtins.map
|
||||
(user:
|
||||
{
|
||||
assertion =
|
||||
let u = inputs.config.users.users.${user}; in u.hashedPasswordFile != null || u.hashedPassword != null;
|
||||
message = "User '${user}' must have either 'hashedPasswordFile' or 'hashedPassword' set.";
|
||||
})
|
||||
inputs.config.nixos.user.users;
|
||||
}
|
||||
# setup root
|
||||
{
|
||||
users.users.root =
|
||||
|
||||
Reference in New Issue
Block a user