From 72f3d202102794b4e760e911dc9a641eef907792 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 16 Sep 2024 10:45:08 +0200 Subject: [PATCH] nixos/polkit/network: create and allow to manage wireguard client services --- nix-os/polkit/network.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 nix-os/polkit/network.nix diff --git a/nix-os/polkit/network.nix b/nix-os/polkit/network.nix new file mode 100644 index 0000000..76d559f --- /dev/null +++ b/nix-os/polkit/network.nix @@ -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; + }; + }); + ''; + }; +}