Merge pull request #272314 from NickCao/ppd

nixos/power-profiles-daemon: add package option
This commit is contained in:
Nick Cao 2023-12-10 11:34:46 -05:00 committed by GitHub
commit 38304747b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.power-profiles-daemon;
package = pkgs.power-profiles-daemon;
in
{
@ -15,8 +12,8 @@ in
services.power-profiles-daemon = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc ''
Whether to enable power-profiles-daemon, a DBus daemon that allows
@ -24,6 +21,8 @@ in
'';
};
package = lib.mkPackageOption pkgs "power-profiles-daemon" { };
};
};
@ -31,7 +30,7 @@ in
###### implementation
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
assertions = [
{ assertion = !config.services.tlp.enable;
@ -42,13 +41,13 @@ in
}
];
environment.systemPackages = [ package ];
environment.systemPackages = [ cfg.package ];
services.dbus.packages = [ package ];
services.dbus.packages = [ cfg.package ];
services.udev.packages = [ package ];
services.udev.packages = [ cfg.package ];
systemd.packages = [ package ];
systemd.packages = [ cfg.package ];
};