diff options
author | Jasper Woudenberg <mail@jasperwoudenberg.com> | 2021-06-12 11:35:19 +0200 |
---|---|---|
committer | Jasper Woudenberg <mail@jasperwoudenberg.com> | 2021-06-13 22:11:42 +0200 |
commit | 04d20258ea8945b644fc54188291b4c31269e162 (patch) | |
tree | f860ebce9647ba73d53f6cf821c80eecac3cbeba /nixos/modules/hardware/system-76.nix | |
parent | b94e1977e0c89060d3ba63bbfa6372e0f0d231b3 (diff) |
system76-power: init at 1.1.16
Diffstat (limited to 'nixos/modules/hardware/system-76.nix')
-rw-r--r-- | nixos/modules/hardware/system-76.nix | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/nixos/modules/hardware/system-76.nix b/nixos/modules/hardware/system-76.nix index ed661fd3303bb..3a50c5aa0f0cc 100644 --- a/nixos/modules/hardware/system-76.nix +++ b/nixos/modules/hardware/system-76.nix @@ -34,6 +34,25 @@ let wantedBy = [ "multi-user.target" ]; }; }; + + power-pkg = pkgs.system76-power; + powerConfig = mkIf cfg.power-daemon.enable { + # Make system76-power usable by root from the command line. + environment.systemPackages = [ power-pkg ]; + + services.dbus.packages = [ power-pkg ]; + + systemd.services.system76-power = { + description = "System76 Power Daemon"; + serviceConfig = { + ExecStart = "${power-pkg}/bin/system76-power daemon"; + Restart = "on-failure"; + Type = "dbus"; + BusName = "com.system76.PowerDaemon"; + }; + wantedBy = [ "multi-user.target" ]; + }; + }; in { options = { hardware.system76 = { @@ -52,8 +71,15 @@ in { description = "Whether to make the system76 out-of-tree kernel modules available"; type = types.bool; }; + + power-daemon.enable = mkOption { + default = cfg.enableAll; + example = true; + description = "Whether to enable the system76 power daemon"; + type = types.bool; + }; }; }; - config = mkMerge [ moduleConfig firmwareConfig ]; + config = mkMerge [ moduleConfig firmwareConfig powerConfig ]; } |