2020-09-14 10:49:42 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.power-profiles-daemon;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.power-profiles-daemon = {
|
|
|
|
|
2023-12-05 18:17:29 +00:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2020-09-14 10:49:42 +00:00
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable power-profiles-daemon, a DBus daemon that allows
|
|
|
|
changing system behavior based upon user-selected power profiles.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-12-05 18:17:46 +00:00
|
|
|
package = lib.mkPackageOption pkgs "power-profiles-daemon" { };
|
|
|
|
|
2020-09-14 10:49:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2023-12-05 18:17:29 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2020-09-14 10:49:42 +00:00
|
|
|
|
|
|
|
assertions = [
|
|
|
|
{ assertion = !config.services.tlp.enable;
|
|
|
|
message = ''
|
|
|
|
You have set services.power-profiles-daemon.enable = true;
|
|
|
|
which conflicts with services.tlp.enable = true;
|
|
|
|
'';
|
|
|
|
}
|
2024-06-08 18:54:56 +00:00
|
|
|
{ assertion = !config.services.auto-cpufreq.enable;
|
|
|
|
message = ''
|
|
|
|
You have set services.power-profiles-daemon.enable = true;
|
|
|
|
which conflicts with services.auto-cpufreq.enable = true;
|
|
|
|
'';
|
|
|
|
}
|
2020-09-14 10:49:42 +00:00
|
|
|
];
|
|
|
|
|
2023-12-05 18:17:46 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2021-10-29 03:31:43 +00:00
|
|
|
|
2023-12-05 18:17:46 +00:00
|
|
|
services.dbus.packages = [ cfg.package ];
|
2020-09-14 10:49:42 +00:00
|
|
|
|
2023-12-05 18:17:46 +00:00
|
|
|
services.udev.packages = [ cfg.package ];
|
2020-09-14 10:49:42 +00:00
|
|
|
|
2023-12-05 18:17:46 +00:00
|
|
|
systemd.packages = [ cfg.package ];
|
2020-09-14 10:49:42 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|