about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2017-10-14 10:27:09 -0400
committerGitHub <noreply@github.com>2017-10-14 10:27:09 -0400
commit55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8 (patch)
tree3bd1c45c067e5a43605f28286e17cfe043af1528 /nixos/modules/config
parenta062e325b0a12a1ea3c20be78ada1e9a89d48a68 (diff)
parent7b818893947747485c14a1c5bf663b1560e7284e (diff)
downloadnixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar.gz
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar.bz2
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar.lz
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar.xz
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.tar.zst
nixlib-55bc53d1dd9f99e59a8f218e98b5e484e2e6eae8.zip
Merge pull request #30258 from srhb/tz-nospace
nixos/config/timezone: Disallow spaces
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/timezone.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix
index aa030a816d04..b15948f6e2e5 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -5,6 +5,9 @@ with lib;
 let
 
   tzdir = "${pkgs.tzdata}/share/zoneinfo";
+  nospace  = str: filter (c: c == " ") (stringToCharacters str) == [];
+  timezone = types.nullOr (types.addCheck types.str nospace)
+    // { description = "null or string without spaces"; };
 
 in
 
@@ -15,7 +18,7 @@ in
 
       timeZone = mkOption {
         default = null;
-        type = types.nullOr types.str;
+        type = timezone;
         example = "America/New_York";
         description = ''
           The time zone used when displaying times and dates. See <link