From 3c25e33c2fa77e6fc52ccdd80585289a7f18d7be Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Mon, 30 Dec 2024 14:44:42 +0100 Subject: [PATCH] nixos/services.redshift: remove `with lib;` --- nixos/modules/services/x11/redshift.nix | 45 ++++++++++++------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 661053c20016..849780b53a77 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -4,9 +4,6 @@ pkgs, ... }: - -with lib; - let cfg = config.services.redshift; @@ -16,32 +13,32 @@ in { imports = [ - (mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] ( + (lib.mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] ( config: let - value = getAttrFromPath [ "services" "redshift" "latitude" ] config; + value = lib.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" ] ( + (lib.mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ] ( config: let - value = getAttrFromPath [ "services" "redshift" "longitude" ] config; + value = lib.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 )) - (mkRenamedOptionModule [ "services" "redshift" "provider" ] [ "location" "provider" ]) + (lib.mkRenamedOptionModule [ "services" "redshift" "provider" ] [ "location" "provider" ]) ]; options.services.redshift = { - enable = mkOption { - type = types.bool; + enable = lib.mkOption { + type = lib.types.bool; default = false; description = '' Enable Redshift to change your screen's colour temperature depending on @@ -50,16 +47,16 @@ in }; temperature = { - day = mkOption { - type = types.int; + day = lib.mkOption { + type = lib.types.int; default = 5500; description = '' Colour temperature to use during the day, between `1000` and `25000` K. ''; }; - night = mkOption { - type = types.int; + night = lib.mkOption { + type = lib.types.int; default = 3700; description = '' Colour temperature to use at night, between @@ -69,16 +66,16 @@ in }; brightness = { - day = mkOption { - type = types.str; + day = lib.mkOption { + type = lib.types.str; default = "1"; description = '' Screen brightness to apply during the day, between `0.1` and `1.0`. ''; }; - night = mkOption { - type = types.str; + night = lib.mkOption { + type = lib.types.str; default = "1"; description = '' Screen brightness to apply during the night, @@ -87,10 +84,10 @@ in }; }; - package = mkPackageOption pkgs "redshift" { }; + package = lib.mkPackageOption pkgs "redshift" { }; - executable = mkOption { - type = types.str; + executable = lib.mkOption { + type = lib.types.str; default = "/bin/redshift"; example = "/bin/redshift-gtk"; description = '' @@ -98,8 +95,8 @@ in ''; }; - extraOptions = mkOption { - type = types.listOf types.str; + extraOptions = lib.mkOption { + type = lib.types.listOf lib.types.str; default = [ ]; example = [ "-v" @@ -112,7 +109,7 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { # needed so that .desktop files are installed, which geoclue cares about environment.systemPackages = [ cfg.package ];