From ef64bc598f28818d56c86629dad98b468af9c071 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 2 Oct 2019 22:00:58 +0200 Subject: [PATCH] redshift: add assertion on latitude and longitude These two options must be set if the provider is set to "manual". Closes #841 (cherry picked from commit 8bddc1adab0f7a51476f819fa2197353e8e1d136) --- modules/services/redshift.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/services/redshift.nix b/modules/services/redshift.nix index b1351dfb..5d8431ad 100644 --- a/modules/services/redshift.nix +++ b/modules/services/redshift.nix @@ -123,6 +123,18 @@ in }; config = mkIf cfg.enable { + assertions = [ + { + assertion = + cfg.provider == "manual" + -> cfg.latitude != null && cfg.longitude != null; + message = + "Must provide services.redshift.latitude and" + + " services.redshift.latitude when" + + " services.redshift.provider is set to \"manual\"."; + } + ]; + systemd.user.services.redshift = { Unit = { Description = "Redshift colour temperature adjuster";