From b3fffcac3ee89568a6a64a9b91e40b23b6b087bb Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 5 Apr 2021 15:57:05 +0000 Subject: [PATCH] home: add gammastep --- home/default.nix | 1 + home/gammastep.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 home/gammastep.nix diff --git a/home/default.nix b/home/default.nix index a7609ef..570a0c2 100644 --- a/home/default.nix +++ b/home/default.nix @@ -6,6 +6,7 @@ ./documentation.nix ./firefox ./flameshot.nix + ./gammastep.nix ./git ./gpg.nix ./htop.nix diff --git a/home/gammastep.nix b/home/gammastep.nix new file mode 100644 index 0000000..b96f028 --- /dev/null +++ b/home/gammastep.nix @@ -0,0 +1,42 @@ +{ config, lib, ... }: +let + cfg = config.my.home.gammastep; + + mkTempOption = with lib; description: default: mkOption { + inherit description default; + type = types.int; + example = 1000; + }; + + mkTimeOption = with lib; description: default: mkOption { + inherit description default; + type = types.str; + example = "12:00-14:00"; + }; +in +{ + options.my.home.gammastep = with lib; { + enable = mkEnableOption "gammastep configuration"; + + temperature = { + day = mkTempOption "Colour temperature to use during the day" 6500; + night = mkTempOption "Colour temperature to use during the night" 2500; + }; + + times = { + dawn = mkTimeOption "Dawn time" "6:00-7:30"; + dusk = mkTimeOption "Dawn time" "18:30-20:00"; + }; + }; + + config.services.gammastep = lib.mkIf cfg.enable { + enable = true; + + dawnTime = cfg.times.dawn; + duskTime = cfg.times.dusk; + + temperature = { + inherit (cfg.temperature) day night; + }; + }; +}