diff --git a/home/david/configurations/Tytonidae/default.nix b/home/david/configurations/Tytonidae/default.nix index a598dff..1d641af 100644 --- a/home/david/configurations/Tytonidae/default.nix +++ b/home/david/configurations/Tytonidae/default.nix @@ -9,6 +9,7 @@ { imports = [ ./niri + ./wluma ]; youthlic.programs = { diff --git a/home/david/configurations/Tytonidae/wluma/config.toml b/home/david/configurations/Tytonidae/wluma/config.toml new file mode 100644 index 0000000..8ae2f7d --- /dev/null +++ b/home/david/configurations/Tytonidae/wluma/config.toml @@ -0,0 +1,25 @@ +# [als.iio] +# path = "/sys/bus/iio/devices" +# thresholds = { 0 = "night", 20 = "dark", 80 = "dim", 250 = "normal", 500 = "bright", 800 = "outdoors" } + +[als.webcam] +video = 0 +thresholds = { 0 = "night", 15 = "dark", 30 = "dim", 45 = "normal", 60 = "bright", 75 = "outdoors" } + +# [als.time] +# thresholds = { 0 = "night", 7 = "dark", 9 = "dim", 11 = "normal", 13 = "bright", 16 = "normal", 18 = "dark", 20 = "night" } + +# [als.none] + +[[output.backlight]] +name = "eDP-1" +path = "/sys/class/backlight/intel_backlight" +capturer = "wayland" + +# [[output.ddcutil]] +# name = "Dell Inc. DELL P2415Q" +# capturer = "none" + +[[keyboard]] +name = "keyboard-asus" +path = "/sys/bus/platform/devices/asus-nb-wmi/leds/asus::kbd_backlight" diff --git a/home/david/configurations/Tytonidae/wluma/default.nix b/home/david/configurations/Tytonidae/wluma/default.nix new file mode 100644 index 0000000..50a5098 --- /dev/null +++ b/home/david/configurations/Tytonidae/wluma/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + youthlic.programs.wluma.config = ./config.toml; +} diff --git a/home/modules/default.nix b/home/modules/default.nix index 885667a..b950dc2 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -17,6 +17,7 @@ ./fuzzel.nix ./firefox.nix ./niri.nix + ./wluma.nix ]; options = { diff --git a/home/modules/niri.nix b/home/modules/niri.nix index bb3c2c1..b684ddd 100644 --- a/home/modules/niri.nix +++ b/home/modules/niri.nix @@ -29,6 +29,7 @@ in ]; youthlic.programs = { fuzzel.enable = true; + wluma.enable = true; }; programs.niri = { config = builtins.readFile cfg.config; diff --git a/home/modules/wluma.nix b/home/modules/wluma.nix new file mode 100644 index 0000000..6c30ea8 --- /dev/null +++ b/home/modules/wluma.nix @@ -0,0 +1,57 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.youthlic.programs.wluma; +in +{ + options = { + youthlic.programs.wluma = { + enable = lib.mkEnableOption "wluma"; + config = lib.mkOption { + type = lib.types.path; + example = ./config.toml; + description = '' + path to config file of wluma + ''; + }; + package = lib.mkOption { + type = lib.types.package; + example = pkgs.wluam; + default = pkgs.wluma; + description = '' + pakcage of wluma + ''; + }; + }; + }; + config = lib.mkIf cfg.enable { + home.packages = [ + cfg.package + ]; + xdg.configFile."wluma/config.toml" = { + enable = true; + source = cfg.config; + }; + systemd.user.services.wluma = { + Unit = { + Description = "Adjusting screen brightness based on screen contents and amount of ambient light"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = [ "${lib.getExe cfg.package}" ]; + Restart = "always"; + EnvironmentFile = [ "-%E/wluma/service.conf" ]; + PrivateNetwork = true; + PrivateMounts = false; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; + }; +} diff --git a/nixos/configurations/Tytonidae/users/default.nix b/nixos/configurations/Tytonidae/users/default.nix index f954fb7..ca6a451 100644 --- a/nixos/configurations/Tytonidae/users/default.nix +++ b/nixos/configurations/Tytonidae/users/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: { users.users.david = { isNormalUser = true; @@ -7,8 +7,18 @@ "networkmanager" "libvirtd" "wheel" + "video" ]; }; + services.udev = { + enable = true; + extraRules = '' + ACTION=="add", SUBSYSTEM=="backlight", RUN+="${lib.getExe' pkgs.coreutils "chgrp"} video /sys/class/backlight/%k/brightness" + ACTION=="add", SUBSYSTEM=="backlight", RUN+="${lib.getExe' pkgs.coreutils "chmod"} g+w /sys/class/backlight/%k/brightness" + ACTION=="add", SUBSYSTEM=="leds", RUN+="${lib.getExe' pkgs.coreutils "chgrp"} video /sys/class/leds/%k/brightness" + ACTION=="add", SUBSYSTEM=="leds", RUN+="${lib.getExe' pkgs.coreutils "chmod"} g+w /sys/class/leds/%k/brightness" + ''; + }; programs.fish.enable = true; users.users.david.shell = pkgs.fish; users.users.david.openssh.authorizedKeys.keyFiles = [