1 import ./make-test-python.nix ({ pkgs, ... }:
4 name = "power-profiles-daemon";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ mvnetbiz ];
8 nodes.machine = { pkgs, ... }: {
9 services.power-profiles-daemon.enable = true;
10 environment.systemPackages = [ pkgs.glib ];
15 return machine.succeed(
16 """gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles \
17 --method org.freedesktop.DBus.Properties.Get 'net.hadess.PowerProfiles' 'ActiveProfile'
22 def set_profile(profile):
23 return machine.succeed(
24 """gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles \
25 --method org.freedesktop.DBus.Properties.Set 'net.hadess.PowerProfiles' 'ActiveProfile' "<'{profile}'>"
32 machine.wait_for_unit("multi-user.target")
34 set_profile("power-saver")
35 profile = get_profile()
36 if not "power-saver" in profile:
37 raise Exception("Unable to set power-saver profile")
40 set_profile("balanced")
41 profile = get_profile()
42 if not "balanced" in profile:
43 raise Exception("Unable to set balanced profile")