From ecf5f85a81d9ddd5a5c40eabb0e8fba3c8ed7481 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sun, 15 Sep 2019 18:25:40 +0200 Subject: [PATCH 1/2] nixos/redshift: Move option renames to the module --- nixos/modules/rename.nix | 14 -------------- nixos/modules/services/x11/redshift.nix | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index d1303f90ad8d..0c7c45a4708b 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -273,20 +273,6 @@ with lib; (mkRenamedOptionModule [ "networking" "extraResolvconfConf" ] [ "networking" "resolvconf" "extraConfig" ]) (mkRenamedOptionModule [ "networking" "resolvconfOptions" ] [ "networking" "resolvconf" "extraOptions" ]) - # Redshift - (mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] - (config: - let value = getAttrFromPath [ "services" "redshift" "latitude" ] config; - in if value == null then - throw "services.redshift.latitude is set to null, you can remove this" - else builtins.fromJSON value)) - (mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ] - (config: - let value = getAttrFromPath [ "services" "redshift" "longitude" ] config; - in if value == null then - throw "services.redshift.longitude is set to null, you can remove this" - else builtins.fromJSON value)) - # Redis (mkRemovedOptionModule [ "services" "redis" "user" ] "The redis module now is hardcoded to the redis user.") (mkRemovedOptionModule [ "services" "redis" "dbpath" ] "The redis module now uses /var/lib/redis as data directory.") diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 6ddb4c83764a..048cc16263da 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -9,6 +9,21 @@ let in { + imports = [ + (mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] + (config: + let value = getAttrFromPath [ "services" "redshift" "latitude" ] config; + in if value == null then + throw "services.redshift.latitude is set to null, you can remove this" + else builtins.fromJSON value)) + (mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ] + (config: + let value = getAttrFromPath [ "services" "redshift" "longitude" ] config; + in if value == null then + throw "services.redshift.longitude is set to null, you can remove this" + else builtins.fromJSON value)) + ]; + options.services.redshift = { enable = mkOption { type = types.bool; From e686b39288ed84be08a878175300c05929a049d3 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sun, 15 Sep 2019 18:26:53 +0200 Subject: [PATCH 2/2] nixos/redshift: Add rename for provider option This was an oversight in https://github.com/NixOS/nixpkgs/pull/64309 resulting it backwards incompatibilities --- nixos/modules/services/x11/redshift.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 048cc16263da..21b0b33553ac 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -22,6 +22,7 @@ in { in if value == null then throw "services.redshift.longitude is set to null, you can remove this" else builtins.fromJSON value)) + (mkRenamedOptionModule [ "services" "redshift" "provider" ] [ "location" "provider" ]) ]; options.services.redshift = {