nix-configs/modules/desktop/mate-polkit.nix
2025-04-24 19:47:30 +02:00

32 lines
1 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.mate-polkit;
in
{
options.xyno.desktop.mate-polkit.enable = lib.mkEnableOption "enable mate-polkit as the gui polkit thing";
options.xyno.desktop.mate-polkit.wantedBy = lib.mkOption {
type = lib.types.str;
default = "niri.service";
};
options.xyno.desktop.mate-polkit.package = lib.mkOption {
type = lib.types.package;
default = pkgs.mate.mate-polkit; # we're using mate polkit as it seems to be the only maintained gtk polkit thing (and we're using all the other gtk shit anyways)
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
systemd.user.services.mate-polkit = {
unitConfig.PartOf = "graphical-session.target";
unitConfig.After = "graphical-session.target";
unitConfig.Requisite = "graphical-session.target";
serviceConfig.Restart = "on-failure";
wantedBy = [ cfg.wantedBy ];
script = "exec ${cfg.package}/libexec/polkit-mate-authentication-agent-1";
};
};
}