about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorSarah Brofeldt <sbrofeldt@gmail.com>2017-10-09 20:52:25 +0200
committerSarah Brofeldt <sbrofeldt@gmail.com>2017-10-09 20:52:25 +0200
commit7b818893947747485c14a1c5bf663b1560e7284e (patch)
tree5d962cc84e093004a515053ca7f1b0ad38899c2b /nixos/modules/config
parent3fe7cddc304abb86e61a750a4f807270c7ca7825 (diff)
downloadnixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar.gz
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar.bz2
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar.lz
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar.xz
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.tar.zst
nixlib-7b818893947747485c14a1c5bf663b1560e7284e.zip
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