diff options
author | Klemens Nanni <klemens@posteo.de> | 2022-06-25 15:59:43 +0400 |
---|---|---|
committer | Klemens Nanni <klemens@posteo.de> | 2022-06-25 16:34:47 +0400 |
commit | 574a90771f3c0eeeeab798c38fea5f7bf6b44066 (patch) | |
tree | bcf394db8441ed6e9d163016fb6253141f6a419a /lib | |
parent | 41c91c48eee8801b91eb6c18ef763b11dc059047 (diff) |
lib.types, nixos/users: Make passwdEntry available
More nixpkgs code such as `boot.initrd.systemd.emergencyAccess` defines options that takes hashed passwords, so move the type definition from modules/ into lib/. The type definition itself stays unchanged.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.nix | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix index 354714b287333..d7655bc1a6a2f 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -55,6 +55,7 @@ let concatMapStringsSep concatStringsSep escapeNixString + hasInfix isCoercibleToString ; inherit (lib.trivial) @@ -360,6 +361,11 @@ rec { deprecationMessage = "See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types."; }; + passwdEntry = entryType: addCheck entryType (str: !(hasInfix ":" str || hasInfix "\n" str)) // { + name = "passwdEntry ${entryType.name}"; + description = "${entryType.description}, not containing newlines or colons"; + }; + attrs = mkOptionType { name = "attrs"; description = "attribute set"; |