Commit 4c0a299d authored by Doron Behar's avatar Doron Behar
Browse files

gnomeExtensions.systemd-manager: allow install polkit files

parent e3945f25
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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 = {