brightnessctl: fix udev rules so i can run it again

This commit is contained in:
Colin 2024-06-01 12:02:24 +00:00
parent 539d9e45a2
commit 05986d363d
3 changed files with 25 additions and 8 deletions

View File

@ -406,14 +406,6 @@ in
bridge-utils.sandbox.method = "bwrap"; #< bwrap, landlock: both work
bridge-utils.sandbox.net = "all";
brightnessctl.sandbox.method = "landlock"; # also bwrap, but landlock is more responsive
brightnessctl.sandbox.extraPaths = [
"/sys/class/backlight"
"/sys/class/leds"
"/sys/devices"
];
brightnessctl.sandbox.whitelistDbus = [ "system" ];
btrfs-progs.sandbox.method = "bwrap"; #< bwrap, landlock: both work
btrfs-progs.sandbox.autodetectCliPaths = "existing"; # e.g. `btrfs filesystem df /my/fs`

View File

@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.brightnessctl;
in
{
sane.programs.brightnessctl = {
sandbox.method = "landlock"; # also bwrap, but landlock is more responsive
sandbox.extraPaths = [
"/sys/class/backlight"
"/sys/class/leds"
"/sys/devices"
];
#v TODO: should be safe to remove
sandbox.whitelistDbus = [ "system" ];
};
services.udev.extraRules = let
chmod = "${pkgs.coreutils}/bin/chmod";
chown = "${pkgs.coreutils}/bin/chown";
in lib.mkIf cfg.enabled ''
# make backlight controllable by members of `video`
SUBSYSTEM=="backlight", RUN+="${chown} :video $sys$devpath/brightness", RUN+="${chmod} g+w $sys$devpath/brightness"
'';
}

View File

@ -13,6 +13,7 @@
./blast-ugjka
./bonsai.nix
./brave.nix
./brightnessctl.nix
./bubblewrap.nix
./callaudiod.nix
./calls.nix