gnomeExtensions.systemd-manager: allow install polkit files

This commit is contained in:
Doron Behar 2024-06-21 13:43:54 +03:00
parent e3945f2507
commit 4c0a299d2c

View File

@ -3,8 +3,15 @@
stdenvNoCC,
fetchFromGitHub,
glib,
# These loosen security a bit, so we don't install them by default. See also:
# https://github.com/hardpixel/systemd-manager?tab=readme-ov-file#without-password-prompt
allowPolkitPolicy ? "none",
config,
systemd ? config.systemd.package,
}:
assert lib.elem allowPolkitPolicy [ "none" "pkexec" "systemctl" ];
stdenvNoCC.mkDerivation rec {
pname = "gnome-shell-extension-systemd-manager";
version = "16";
@ -26,6 +33,15 @@ stdenvNoCC.mkDerivation rec {
mkdir -p $out/share/gnome-shell/extensions
mv systemd-manager@hardpixel.eu $out/share/gnome-shell/extensions
'' + lib.optionalString (allowPolkitPolicy == "pkexec") ''
local bn=org.freedesktop.policykit.pkexec.systemctl.policy
mkdir -p $out/share/polkit-1/actions
substitute systemd-policies/$bn $out/share/polkit-1/actions/$bn \
--replace-fail /usr/bin/systemctl ${lib.getBin systemd}/bin/systemctl
'' + lib.optionalString (allowPolkitPolicy == "systemctl") ''
install -Dm0644 \
systemd-policies/10-service_status.rules \
$out/share/polkit-1/rules.d/10-gnome-extension-systemd-manager.rules
'';
passthru = {