{ 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 = "${cfg.package}/libexec/polkit-mate-authentication-agent-1"; }; }; }