diff --git a/lib/types.nix b/lib/types.nix index 244cbb6b5354..0e702fb2f2ed 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -300,6 +300,13 @@ rec { inherit (str) merge; }; + singleLineStr = mkOptionType { + name = "singleLineStr"; + description = "string that doesn't contain '\\n'"; + check = x: str.check x && !(lib.hasInfix "\n" x); + inherit (str) merge; + }; + strMatching = pattern: mkOptionType { name = "strMatching ${escapeNixString pattern}"; description = "string matching the pattern ${pattern}"; diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 004b4f99670f..52a1982b3f0a 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -30,7 +30,7 @@ let options.openssh.authorizedKeys = { keys = mkOption { - type = types.listOf types.str; + type = types.listOf types.singleLineStr; default = []; description = '' A list of verbatim OpenSSH public keys that should be added to the