diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2021-06-23 12:54:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 12:54:22 +0200 |
commit | 1956a52857ce6d57af4f129827b043b6f8df1a7d (patch) | |
tree | 45397fae99b289a4bc406559164df811d1c29330 /nixos/modules | |
parent | b1662abccc3c22f8b78104cd3f11139e28cdae9d (diff) | |
parent | debaa484fe717968b2dd4d96e4a36a671da5e6a4 (diff) | |
download | nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar.gz nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar.bz2 nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar.lz nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar.xz nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.tar.zst nixpkgs-1956a52857ce6d57af4f129827b043b6f8df1a7d.zip |
Merge pull request #126656 from jwoudenberg/add-system76-power
Diffstat (limited to 'nixos/modules')
-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 ed661fd3303..3a50c5aa0f0 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 ]; } |