at master 1.6 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.cpupower-gui; 9in 10{ 11 options = { 12 services.cpupower-gui = { 13 enable = lib.mkOption { 14 type = lib.types.bool; 15 default = false; 16 example = true; 17 description = '' 18 Enables dbus/systemd service needed by cpupower-gui. 19 These services are responsible for retrieving and modifying cpu power 20 saving settings. 21 ''; 22 }; 23 }; 24 }; 25 26 config = lib.mkIf cfg.enable { 27 environment.systemPackages = [ pkgs.cpupower-gui ]; 28 services.dbus.packages = [ pkgs.cpupower-gui ]; 29 systemd.user = { 30 services.cpupower-gui-user = { 31 description = "Apply cpupower-gui config at user login"; 32 wantedBy = [ "graphical-session.target" ]; 33 serviceConfig = { 34 Type = "oneshot"; 35 ExecStart = "${pkgs.cpupower-gui}/bin/cpupower-gui config"; 36 }; 37 }; 38 }; 39 systemd.services = { 40 cpupower-gui = { 41 description = "Apply cpupower-gui config at boot"; 42 wantedBy = [ "multi-user.target" ]; 43 serviceConfig = { 44 Type = "oneshot"; 45 ExecStart = "${pkgs.cpupower-gui}/bin/cpupower-gui config"; 46 }; 47 }; 48 cpupower-gui-helper = { 49 description = "cpupower-gui system helper"; 50 aliases = [ "dbus-org.rnd2.cpupower_gui.helper.service" ]; 51 serviceConfig = { 52 Type = "dbus"; 53 BusName = "org.rnd2.cpupower_gui.helper"; 54 ExecStart = "${pkgs.cpupower-gui}/lib/cpupower-gui/cpupower-gui-helper"; 55 }; 56 }; 57 }; 58 }; 59}