about summary refs log tree commit diff
path: root/nixos/modules/services/x11/clight.nix
diff options
context:
space:
mode:
authorEdmund Wu <fangkazuto@gmail.com>2020-04-02 21:33:02 -0400
committerEdmund Wu <fangkazuto@gmail.com>2020-04-07 14:15:26 -0400
commit13f9a356e07cc2b1db9bf978b36b2fb4dae15a1e (patch)
tree8940d359c3b5af361de402755dcb29c9ae406ea5 /nixos/modules/services/x11/clight.nix
parent28d8bc7251377852015116130df9ad64660953a2 (diff)
clight: include location assertion
Diffstat (limited to 'nixos/modules/services/x11/clight.nix')
-rw-r--r--nixos/modules/services/x11/clight.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/clight.nix b/nixos/modules/services/x11/clight.nix
index 4daf6d8d9db7e..7aa1580c4726b 100644
--- a/nixos/modules/services/x11/clight.nix
+++ b/nixos/modules/services/x11/clight.nix
@@ -63,6 +63,14 @@ in {
   };
 
   config = mkIf cfg.enable {
+    assertions = let
+      inRange = v: l: r: v >= l && v <= r;
+    in [
+      { assertion = config.location.provider == "manual" ->
+          inRange config.location.latitude (-90) 90 && inRange config.location.longitude (-180) 180;
+        message = "You must specify a valid latitude and longitude if manually providing location"; }
+    ];
+
     boot.kernelModules = [ "i2c_dev" ];
     environment.systemPackages = with pkgs; [ clight clightd ];
     services.dbus.packages = with pkgs; [ clight clightd ];