add wluma to control backlight

This commit is contained in:
ulic-youthlic 2025-01-15 16:45:19 +08:00
parent 605f5c9b20
commit e3e25560ca
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
7 changed files with 100 additions and 1 deletions

View file

@ -17,6 +17,7 @@
./fuzzel.nix
./firefox.nix
./niri.nix
./wluma.nix
];
options = {

View file

@ -29,6 +29,7 @@ in
];
youthlic.programs = {
fuzzel.enable = true;
wluma.enable = true;
};
programs.niri = {
config = builtins.readFile cfg.config;

57
home/modules/wluma.nix Normal file
View file

@ -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" ];
};
};
};
}