Fix password hash file generation behavior

- Move the "create password hash file from hashed password" behavior to
  a separate variable, since having it in the default field of config
  would always cause the warning to trigger
- Change type of hashedPassword to `nullOr str`
This commit is contained in:
Galen Abell 2020-03-06 17:27:47 +00:00 committed by lewo
parent 7bda4c4f11
commit 6563abc1c4
5 changed files with 95 additions and 23 deletions

View file

@ -56,10 +56,27 @@ in
};
hashedPassword = mkOption {
type = types.str;
type = with types; nullOr str;
default = null;
example = "$6$evQJs5CFQyPAW09S$Cn99Y8.QjZ2IBnSu4qf1vBxDRWkaIZWOtmu1Ddsm3.H3CFpeVc0JU4llIq8HQXgeatvYhh5O33eWG3TSpjzu6/";
description = ''
Hashed password. Use `mkpasswd` as follows
The user's hashed password. Use `mkpasswd` as follows
```
mkpasswd -m sha-512 "super secret password"
```
Warning: this is stored in plaintext in the Nix store!
Use `hashedPasswordFile` instead.
'';
};
hashedPasswordFile = mkOption {
type = with types; nullOr path;
default = null;
example = "/run/keys/user1-passwordhash";
description = ''
A file containing the user's hashed password. Use `mkpasswd` as follows
```
mkpasswd -m sha-512 "super secret password"