diff --git a/modules/services/polkit-gnome.nix b/modules/services/polkit-gnome.nix new file mode 100644 index 00000000..7b9d31ad --- /dev/null +++ b/modules/services/polkit-gnome.nix @@ -0,0 +1,35 @@ +{ + lib, + pkgs, + config, + ... +}: let + inherit (lib) mkIf mkEnableOption mkOption mkPackageOption; + cfg = config.services.polkit-gnome; +in { + meta.maintainers = []; # TODO: add maintainer + + options.services.polkit-gnome = { + enable = mkEnableOption "polkit-gnome"; + package = mkPackageOption pkgs "polkit_gnome"; # TODO: make it global + systemd = mkEnableOption "systemd service for polkit-gnome" // mkOption {default = true;}; + }; + + config = mkIf cfg.enable { + systemd.user = mkIf cfg.systemd { + services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = ["graphical-session.target"]; + wants = ["graphical-session.target"]; + after = ["graphical-session.target"]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + }; +}