nixos/polkit/network: create and allow to manage wireguard client services

This commit is contained in:
Wroclaw 2024-09-16 10:45:08 +02:00
parent d543c41694
commit 72f3d20210

16
nix-os/polkit/network.nix Normal file
View file

@ -0,0 +1,16 @@
{
config = {
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
// Allow to start and stop wireguard client services
if (
action.id == "org.freedesktop.systemd1.manage-units" &&
action.lookup("unit") &&
action.lookup("unit").match(/^wg-quick-.*\.service$/)
) {
return polkit.Result.YES;
};
});
'';
};
}