From 5ae7c016f3df5c2d63192f0e3e314e2fbf2fdaf8 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Thu, 13 Mar 2025 21:46:08 +0000
Subject: [PATCH] Add redshift

> Redshift adjusts the color temperature of your screen according to
your surroundings. This may help your eyes hurt less if you are working
in front of the screen at night.

https://github.com/jonls/redshift
https://nixos.wiki/wiki/Redshift
---
 nix/hosts/t490/configuration.nix     |  1 +
 nix/hosts/t490/services/default.nix  |  1 +
 nix/hosts/t490/services/redshift.nix | 31 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 nix/hosts/t490/services/redshift.nix

diff --git a/nix/hosts/t490/configuration.nix b/nix/hosts/t490/configuration.nix
index c063abb6..30d97293 100644
--- a/nix/hosts/t490/configuration.nix
+++ b/nix/hosts/t490/configuration.nix
@@ -19,6 +19,7 @@
     autorandr.enable = true;
     dwm.enable = true;
     gaming.enable = true;
+    redshift.enable = true;
     st.enable = true;
     thunar.enable = true;
     peek.enable = true;
diff --git a/nix/hosts/t490/services/default.nix b/nix/hosts/t490/services/default.nix
index ce7ea823..ef7c3c7b 100644
--- a/nix/hosts/t490/services/default.nix
+++ b/nix/hosts/t490/services/default.nix
@@ -2,6 +2,7 @@
   imports = [
     ./cron.nix
     ./interception-tools.nix
+    ./redshift.nix
     ./sound.nix
     ./udev.nix
     ./xserver.nix
diff --git a/nix/hosts/t490/services/redshift.nix b/nix/hosts/t490/services/redshift.nix
new file mode 100644
index 00000000..3fcfdf4f
--- /dev/null
+++ b/nix/hosts/t490/services/redshift.nix
@@ -0,0 +1,31 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.nixosModules.redshift;
+in
+{
+  options.nixosModules.redshift.enable = mkEnableOption "Enable redshift";
+
+  config = mkIf cfg.enable {
+    location = {
+      latitude = 51.48;
+      longitude = -3.17;
+    };
+
+    services.redshift = {
+      enable = true;
+
+      brightness = {
+        day = "1";
+        night = "1";
+      };
+
+      temperature = {
+        day = 5500;
+        night = 3700;
+      };
+    };
+  };
+}