about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorArtturin2024-06-26 12:42:38 +0300
committerGitHub2024-06-26 12:42:38 +0300
commit1ecc3cd35bf1550997be0e0a6d3854093cca95bb (patch)
tree2a1dd85270d52d09911b64236e17fe0b8d9947d2 /nixos/modules
parentca48a251565682e14eee57e94e4e71829d67504e (diff)
parentb61e0ff19bbda7b9962b30c912e1a789e0ced1c2 (diff)
Merge pull request #322194 from Artturin/polkitaddpackageoption
nixos/polkit: Add package option
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/security/polkit.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix
index f7ee4f0068dd..76f623096fb7 100644
--- a/nixos/modules/security/polkit.nix
+++ b/nixos/modules/security/polkit.nix
@@ -14,6 +14,8 @@ in
 
     security.polkit.enable = mkEnableOption "polkit";
 
+    security.polkit.package = mkPackageOption pkgs "polkit" { };
+
     security.polkit.debug = mkEnableOption "debug logs from polkit. This is required in order to see log messages from rule definitions";
 
     security.polkit.extraConfig = mkOption {
@@ -57,13 +59,13 @@ in
 
   config = mkIf cfg.enable {
 
-    environment.systemPackages = [ pkgs.polkit.bin pkgs.polkit.out ];
+    environment.systemPackages = [ cfg.package.bin cfg.package.out ];
 
-    systemd.packages = [ pkgs.polkit.out ];
+    systemd.packages = [ cfg.package.out ];
 
     systemd.services.polkit.serviceConfig.ExecStart = [
       ""
-      "${pkgs.polkit.out}/lib/polkit-1/polkitd ${optionalString (!cfg.debug) "--no-debug"}"
+      "${cfg.package.out}/lib/polkit-1/polkitd ${optionalString (!cfg.debug) "--no-debug"}"
     ];
 
     systemd.services.polkit.restartTriggers = [ config.system.path ];
@@ -82,7 +84,7 @@ in
         ${cfg.extraConfig}
       ''; #TODO: validation on compilation (at least against typos)
 
-    services.dbus.packages = [ pkgs.polkit.out ];
+    services.dbus.packages = [ cfg.package.out ];
 
     security.pam.services.polkit-1 = {};
 
@@ -91,13 +93,13 @@ in
         { setuid = true;
           owner = "root";
           group = "root";
-          source = "${pkgs.polkit.bin}/bin/pkexec";
+          source = "${cfg.package.bin}/bin/pkexec";
         };
       polkit-agent-helper-1 =
         { setuid = true;
           owner = "root";
           group = "root";
-          source = "${pkgs.polkit.out}/lib/polkit-1/polkit-agent-helper-1";
+          source = "${cfg.package.out}/lib/polkit-1/polkit-agent-helper-1";
         };
     };