From a0e3efd95d6bc49eda4ce6ef815c49d0bb91110a Mon Sep 17 00:00:00 2001 From: Yash Raj Date: Mon, 8 Jul 2024 03:47:29 +0530 Subject: [PATCH] Create polkit-gnome.nix --- modules/services/polkit-gnome.nix | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 modules/services/polkit-gnome.nix diff --git a/modules/services/polkit-gnome.nix b/modules/services/polkit-gnome.nix new file mode 100644 index 000000000..7b9d31adc --- /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; + }; + }; + }; + }; +}