I’ve been trying to get polkit version 127 working on my system so that run0 can cache authorization but am thus far unsuccessful. With my current best attempt, pkcheck --version returns 127 and etc/polkit-1/rules.d/10-nixos.rules is as expected, but run0 still asks for re-authorization every time it is run.
I’ve tried to get things working via overlays, but have only gotten confusing errors for my troubles.
config excerpts
# pins.nix
{ config, pkgs, lib, uPkgs, ... }:
let
sources = import ./npins;
in {
nix.channel.enable = false;
nix.nixPath = lib.mapAttrsToList (k: v: "${k}=${v}") sources;
# unstable repository
_module.args.uPkgs = import <nixos-unstable> {
config = config.nixpkgs.config;
};
nixpkgs.overlays = [
(final: prev: {
# overlay attempt 1
# kdePackages.polkit-qt-1 = prev.kdePackages.polkit-qt-1.override {polkit = uPkgs.polkit; };
# overlay attempt 2
# polkit = uPkgs.polkit
})
];
}
# configuration.nix
{ config, pkgs, lib, uPkgs, ... }:
{
imports = [
...
./pins.nix
];
...
security.polkit = {
enable = true;
package = uPkgs.polkit;
extraConfig = ''
polkit.addRule(function(action, subject) {
if (
action.id == "org.freedesktop.systemd1.manage-units" &&
(
subject.isInGroup("wheel") ||
subject.isInGroup("users")
)
) {
return polkit.Result.AUTH_ADMIN_KEEP;
}
});
'';
};
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
...
overlay attempt 1 error
error:
… while calling the 'head' builtin
at /nix/store/1k8m24kpk74wcbs2x4nxbd9dnc9lvd6j-source/lib/attrsets.nix:1696:13:
1695| if length values == 1 || pred here (elemAt values 1) (head values) then
1696| head values
| ^
1697| else
… while evaluating the attribute 'value'
at /nix/store/1k8m24kpk74wcbs2x4nxbd9dnc9lvd6j-source/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/1k8m24kpk74wcbs2x4nxbd9dnc9lvd6j-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `xdg.portal.extraPortals':
… while evaluating definitions from `/nix/store/1k8m24kpk74wcbs2x4nxbd9dnc9lvd6j-source/nixos/modules/services/desktop-managers/plasma6.nix':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: attribute 'kwallet' missing
at /nix/store/1k8m24kpk74wcbs2x4nxbd9dnc9lvd6j-source/nixos/modules/services/desktop-managers/plasma6.nix:289:7:
288| xdg.portal.extraPortals = [
289| kdePackages.kwallet
| ^
290| kdePackages.xdg-desktop-portal-kde
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.toplevel --dry-run' returned non-zero exit status 1.
Attempt 2 didn’t error on dry-run, but required rebuilding 274 derivations, which seems excessive. After trying it regardless and waiting out the process of them getting rebuilt, it ultimately ended in an error which I unfortunately neglected to save. If the error is needed, I can go through that tedious build again, but ideally I would only be building the things required for run0 to work with polkit 127 if it comes to that.