nixos/polkit: Add debug option

Changed files
+8
nixos
modules
security
+8
nixos/modules/security/polkit.nix
···
security.polkit.enable = mkEnableOption (lib.mdDoc "polkit");
security.polkit.extraConfig = mkOption {
type = types.lines;
default = "";
···
''
/* Log authorization checks. */
polkit.addRule(function(action, subject) {
polkit.log("user " + subject.user + " is attempting action " + action.id + " from PID " + subject.pid);
});
···
environment.systemPackages = [ pkgs.polkit.bin pkgs.polkit.out ];
systemd.packages = [ pkgs.polkit.out ];
systemd.services.polkit.restartTriggers = [ config.system.path ];
systemd.services.polkit.stopIfChanged = false;
···
security.polkit.enable = mkEnableOption (lib.mdDoc "polkit");
+
security.polkit.debug = mkEnableOption (lib.mdDoc "debug logs from polkit. This is required in order to see log messages from rule definitions.");
+
security.polkit.extraConfig = mkOption {
type = types.lines;
default = "";
···
''
/* Log authorization checks. */
polkit.addRule(function(action, subject) {
+
// Make sure to set { security.polkit.debug = true; } in configuration.nix
polkit.log("user " + subject.user + " is attempting action " + action.id + " from PID " + subject.pid);
});
···
environment.systemPackages = [ pkgs.polkit.bin pkgs.polkit.out ];
systemd.packages = [ pkgs.polkit.out ];
+
+
systemd.services.polkit.serviceConfig.ExecStart = [
+
""
+
"${pkgs.polkit.out}/lib/polkit-1/polkitd ${optionalString (!cfg.debug) "--no-debug"}"
+
];
systemd.services.polkit.restartTriggers = [ config.system.path ];
systemd.services.polkit.stopIfChanged = false;