about summary refs log tree commit diff
path: root/nixos/modules/services/x11/clight.nix
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-11-12 18:09:40 +0100
committerGitHub <noreply@github.com>2021-11-12 18:09:40 +0100
commitfee23ab3f1628ae9b072c357d729d6f9c520e5d5 (patch)
treefa3f3d23f54744db7864afb40b8acb947811c942 /nixos/modules/services/x11/clight.nix
parent2464a542d00c4d0fc7f30876753cc79c54705546 (diff)
parent13f9a356e07cc2b1db9bf978b36b2fb4dae15a1e (diff)
Merge pull request #84154 from eadwu/clight/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 873f425fb8be4..d994a658cbaa5 100644
--- a/nixos/modules/services/x11/clight.nix
+++ b/nixos/modules/services/x11/clight.nix
@@ -71,6 +71,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 ];