summary refs log tree commit diff
path: root/pkgs/os-specific/linux/power-profiles-daemon
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-10-29 05:31:43 +0200
committerJan Tojnar <jtojnar@gmail.com>2021-10-29 09:17:27 +0200
commit046ec823465877ce67d7209b2be2f94c38205ef2 (patch)
tree9cc429f332c45d9f8b554c50001d93959f80d8ca /pkgs/os-specific/linux/power-profiles-daemon
parent2deb07f3ac4eeb5de1c12c4ba2911a2eb1f6ed61 (diff)
downloadnixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar.gz
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar.bz2
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar.lz
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar.xz
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.tar.zst
nixpkgs-046ec823465877ce67d7209b2be2f94c38205ef2.zip
power-profiles-daemon: 0.8.1 → 0.10.1
https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/blob/0.10.1/NEWS

Requires installing to system for polkit policy.
Diffstat (limited to 'pkgs/os-specific/linux/power-profiles-daemon')
-rw-r--r--pkgs/os-specific/linux/power-profiles-daemon/default.nix47
1 files changed, 43 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/power-profiles-daemon/default.nix b/pkgs/os-specific/linux/power-profiles-daemon/default.nix
index 03267b8e9ae..f9ca936e6ed 100644
--- a/pkgs/os-specific/linux/power-profiles-daemon/default.nix
+++ b/pkgs/os-specific/linux/power-profiles-daemon/default.nix
@@ -6,6 +6,7 @@
 , fetchFromGitLab
 , libgudev
 , glib
+, polkit
 , gobject-introspection
 , gettext
 , gtk-doc
@@ -16,11 +17,12 @@
 , upower
 , systemd
 , python3
+, wrapGAppsNoGuiHook
 }:
 
 stdenv.mkDerivation rec {
   pname = "power-profiles-daemon";
-  version = "0.8.1";
+  version = "0.10.1";
 
   outputs = [ "out" "devdoc" ];
 
@@ -29,7 +31,7 @@ stdenv.mkDerivation rec {
     owner = "hadess";
     repo = "power-profiles-daemon";
     rev = version;
-    sha256 = "sha256-OnCUr7KWVPpYGDseBUcJD/PdOobvFnyNA97NhnKbTKY=";
+    sha256 = "sha256-sQWiCHc0kEELdmPq9Qdk7OKDUgbM5R44639feC7gjJc=";
   };
 
   nativeBuildInputs = [
@@ -43,6 +45,9 @@ stdenv.mkDerivation rec {
     libxml2 # for xmllint for stripping GResources
     libxslt # for xsltproc for building docs
     gobject-introspection
+    python3
+    wrapGAppsNoGuiHook
+    python3.pkgs.wrapPython
   ];
 
   buildInputs = [
@@ -50,7 +55,15 @@ stdenv.mkDerivation rec {
     systemd
     upower
     glib
-    (python3.withPackages (ps: with ps; [ ps.pygobject3 ])) # for cli tool
+    polkit
+    python3 # for cli tool
+  ];
+
+  strictDeps = true;
+
+  # for cli tool
+  pythonPath = [
+    python3.pkgs.pygobject3
   ];
 
   mesonFlags = [
@@ -58,11 +71,37 @@ stdenv.mkDerivation rec {
     "-Dgtk_doc=true"
   ];
 
+  PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
+
+  # Avoid double wrapping
+  dontWrapGApps = true;
+
+  postPatch = ''
+    patchShebangs tests/unittest_inspector.py
+  '';
+
+  preInstall = ''
+    # We have pkexec on PATH so Meson will try to use it when installation fails
+    # due to being unable to write to e.g. /etc.
+    # Let’s pretend we already ran pkexec –
+    # the pkexec on PATH would complain it lacks setuid bit,
+    # obscuring the underlying error.
+    # https://github.com/mesonbuild/meson/blob/492cc9bf95d573e037155b588dc5110ded4d9a35/mesonbuild/minstall.py#L558
+    export PKEXEC_UID=-1
+  '';
+
+  postFixup = ''
+    # Avoid double wrapping
+    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
+    # Make Python libraries available
+    wrapPythonProgramsIn "$out/bin" "$pythonPath"
+  '';
+
   meta = with lib; {
     homepage = "https://gitlab.freedesktop.org/hadess/power-profiles-daemon";
     description = "Makes user-selected power profiles handling available over D-Bus";
     platforms = platforms.linux;
     license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ mvnetbiz ];
+    maintainers = with maintainers; [ jtojnar mvnetbiz ];
   };
 }