Create polkit-gnome.nix

This commit is contained in:
Yash Raj 2024-07-08 03:47:29 +05:30 committed by GitHub
parent f9381b8364
commit a0e3efd95d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
};
};
};
};
}