From 643a05edbd612af7b61b220de0cae43bb207d5bf Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Fri, 7 Mar 2025 23:06:10 +0100 Subject: [PATCH] Install and configure wluma on fern --- modules/home/de/hyprland/default.nix | 1 + modules/home/de/wluma.nix | 48 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 modules/home/de/wluma.nix diff --git a/modules/home/de/hyprland/default.nix b/modules/home/de/hyprland/default.nix index ccdb777..1c4ea99 100644 --- a/modules/home/de/hyprland/default.nix +++ b/modules/home/de/hyprland/default.nix @@ -27,6 +27,7 @@ waybar.enable = true; cliphist.enable = true; gammastep.enable = true; + wluma.enable = true; }; services.dunst.enable = true; diff --git a/modules/home/de/wluma.nix b/modules/home/de/wluma.nix new file mode 100644 index 0000000..342ec8f --- /dev/null +++ b/modules/home/de/wluma.nix @@ -0,0 +1,48 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + options.myConfig.de.wluma.enable = lib.mkEnableOption ""; + + config = lib.mkIf config.myConfig.de.wluma.enable { + home.packages = [ pkgs.wluma ]; + + xdg.configFile."wluma/config.toml".source = (pkgs.formats.toml { }).generate "wluma-config" { + als.iio = { + path = "/sys/bus/iio/devices"; + thresholds = { + "0" = "night"; + "20" = "dark"; + "80" = "dim"; + "250" = "normal"; + "500" = "bright"; + "800" = "outdoors"; + }; + }; + output.backlight = [ + { + name = "eDP-1"; + path = "/sys/class/backlight/amdgpu_bl1"; + capturer = "wayland"; + } + ]; + }; + + systemd.user.services.wluma = { + Install.WantedBy = [ "graphical-session.target" ]; + Unit = { + Description = "Automatic brightness adjustment based on screen contents and ALS"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + X-Restart-Triggers = [ config.xdg.configFile."wluma/config.toml".source ]; + }; + Service = { + ExecStart = lib.getExe pkgs.wluma; + Restart = "always"; + }; + }; + }; +}