Files
sydnix/modules/nixos/xbacklight-permissions.nix

36 lines
834 B
Nix

{ config, lib, pkgs, ... }:
let cfg = config.sydnix.xbacklight-permissions;
in {
options.sydnix.xbacklight-permissions = {
enable =
lib.mkEnableOption "the user group that is allowed to use xbacklight";
group = lib.mkOption {
type = lib.types.str;
default = "xbacklight";
};
paths = lib.mkOption {
type = with lib.types; listOf str;
default = [
"/sys/class/backlight/intel_backlight/brightness"
];
};
};
config = lib.mkIf cfg.enable {
users.groups.${cfg.group} = {};
systemd.tmpfiles.settings."50-xbacklight" =
lib.mergeAttrsList
(builtins.map
(path: {
${path}.z = {
inherit (cfg) group;
mode = "0664";
user = "root";
};
})
cfg.paths);
};
}