From 93679d4d0ab7e22acd71d54e43abce590e7ea40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac=20Jacqu=C3=A9?= Date: Sun, 18 Feb 2024 13:43:46 +0100 Subject: [PATCH 1/2] power-profiles-daemon: 0.13 -> 0.20 The upstream original maintainer is not paid anymore to maintain the project and decided to step down. The project has been taken over by the upower team. This is the first release part of this upower team. The integration tests are now relying on the powerprofilectl command: we need to patch the python path of this dependency before running the integration tests instead of doing that during in the fixup phase. Taking advantage of this to remove the PostFixup phase. Not 100% about this move: it's a bit less future proof. --- .../linux/power-profiles-daemon/default.nix | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/pkgs/os-specific/linux/power-profiles-daemon/default.nix b/pkgs/os-specific/linux/power-profiles-daemon/default.nix index e81f42b65a23..dcf146a01fa6 100644 --- a/pkgs/os-specific/linux/power-profiles-daemon/default.nix +++ b/pkgs/os-specific/linux/power-profiles-daemon/default.nix @@ -5,7 +5,6 @@ , mesonEmulatorHook , ninja , fetchFromGitLab -, fetchpatch , libgudev , glib , polkit @@ -21,22 +20,21 @@ , umockdev , systemd , python3 -, wrapGAppsNoGuiHook , nixosTests }: stdenv.mkDerivation rec { pname = "power-profiles-daemon"; - version = "0.13"; + version = "0.20"; outputs = [ "out" "devdoc" ]; src = fetchFromGitLab { domain = "gitlab.freedesktop.org"; - owner = "hadess"; + owner = "upower"; repo = "power-profiles-daemon"; rev = version; - sha256 = "sha256-ErHy+shxZQ/aCryGhovmJ6KmAMt9OZeQGDbHIkC0vUE="; + sha256 = "sha256-8wSRPR/1ELcsZ9K3LvSNlPcJvxRhb/LRjTIxKtdQlCA="; }; nativeBuildInputs = [ @@ -50,8 +48,6 @@ stdenv.mkDerivation rec { libxml2 # for xmllint for stripping GResources libxslt # for xsltproc for building docs gobject-introspection - wrapGAppsNoGuiHook - python3.pkgs.wrapPython # checkInput but cheked for during the configuring (python3.pythonOnBuildForHost.withPackages (ps: with ps; [ pygobject3 @@ -68,16 +64,16 @@ stdenv.mkDerivation rec { upower glib polkit - python3 # for cli tool - # Duplicate from nativeCheckInputs until https://github.com/NixOS/nixpkgs/issues/161570 is solved - umockdev + # for cli tool + (python3.withPackages (ps: [ + ps.pygobject3 + ])) ]; strictDeps = true; - # for cli tool - pythonPath = [ - python3.pkgs.pygobject3 + checkInputs = [ + umockdev ]; nativeCheckInputs = [ @@ -95,26 +91,13 @@ stdenv.mkDerivation rec { PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions"; - # Avoid double wrapping - dontWrapGApps = true; - postPatch = '' patchShebangs --build \ tests/integration-test.py \ tests/unittest_inspector.py - ''; - postCheck = '' - # Do not contaminate the wrapper with test dependencies. - unset GI_TYPELIB_PATH - unset XDG_DATA_DIRS - ''; - - postFixup = '' - # Avoid double wrapping - makeWrapperArgs+=("''${gappsWrapperArgs[@]}") - # Make Python libraries available - wrapPythonProgramsIn "$out/bin" "$pythonPath" + patchShebangs --host \ + src/powerprofilesctl ''; passthru = { From 1da7dfa57d4a380230edba7686a0ffe8a4a31eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac=20Jacqu=C3=A9?= Date: Sun, 18 Feb 2024 13:46:56 +0100 Subject: [PATCH 2/2] nixosTests.power-profiles-daemon: test profilectl CLI We also take advantage of that change to point to the new dbus canonical names. --- nixos/tests/power-profiles-daemon.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/nixos/tests/power-profiles-daemon.nix b/nixos/tests/power-profiles-daemon.nix index c887cde4b829..8a54d8e8bab8 100644 --- a/nixos/tests/power-profiles-daemon.nix +++ b/nixos/tests/power-profiles-daemon.nix @@ -8,22 +8,22 @@ import ./make-test-python.nix ({ pkgs, ... }: nodes.machine = { pkgs, ... }: { security.polkit.enable = true; services.power-profiles-daemon.enable = true; - environment.systemPackages = [ pkgs.glib ]; + environment.systemPackages = [ pkgs.glib pkgs.power-profiles-daemon ]; }; testScript = '' def get_profile(): return machine.succeed( - """gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles \ - --method org.freedesktop.DBus.Properties.Get 'net.hadess.PowerProfiles' 'ActiveProfile' + """gdbus call --system --dest org.freedesktop.UPower.PowerProfiles --object-path /org/freedesktop/UPower/PowerProfiles \ + --method org.freedesktop.DBus.Properties.Get 'org.freedesktop.UPower.PowerProfiles' 'ActiveProfile' """ ) def set_profile(profile): return machine.succeed( - """gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles \ - --method org.freedesktop.DBus.Properties.Set 'net.hadess.PowerProfiles' 'ActiveProfile' "<'{profile}'>" + """gdbus call --system --dest org.freedesktop.UPower.PowerProfiles --object-path /org/freedesktop/UPower/PowerProfiles \ + --method org.freedesktop.DBus.Properties.Set 'org.freedesktop.UPower.PowerProfiles' 'ActiveProfile' "<'{profile}'>" """.format( profile=profile ) @@ -42,5 +42,16 @@ import ./make-test-python.nix ({ pkgs, ... }: profile = get_profile() if not "balanced" in profile: raise Exception("Unable to set balanced profile") + + # test powerprofilectl CLI + machine.succeed("powerprofilesctl set power-saver") + profile = get_profile() + if not "power-saver" in profile: + raise Exception("Unable to set power-saver profile with powerprofilectl") + + machine.succeed("powerprofilesctl set balanced") + profile = get_profile() + if not "balanced" in profile: + raise Exception("Unable to set balanced profile with powerprofilectl") ''; })