system76-power: init at 1.1.16

This commit is contained in:
Jasper Woudenberg 2021-06-12 11:35:19 +02:00
parent b94e1977e0
commit 04d20258ea
3 changed files with 59 additions and 1 deletions

View file

@ -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 ];
}

View file

@ -0,0 +1,30 @@
{ pkg-config, libusb1, dbus, lib, rustPlatform, fetchFromGitHub }:
rustPlatform.buildRustPackage rec {
pname = "system76-power";
version = "1.1.16";
src = fetchFromGitHub {
owner = "pop-os";
repo = "system76-power";
rev = version;
sha256 = "sha256-OtrhvUkNNgg6KlrqjwiBKL4zuQZBWevb0xgtSlEW2rQ=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ dbus libusb1 ];
cargoSha256 = "sha256-ImACDbnUbwc0ZXgF3xxzes8+vUjt76B1xxgqzhgAYX4=";
postInstall = ''
install -D -m 0644 data/system76-power.conf $out/etc/dbus-1/system.d/system76-power.conf
'';
meta = with lib; {
description = "System76 Power Management";
homepage = "https://github.com/pop-os/system76-power";
license = licenses.gpl3Plus;
platforms = [ "i686-linux" "x86_64-linux" ];
maintainers = [ maintainers.jwoudenberg ];
};
}

View file

@ -20829,6 +20829,8 @@ in
system76-acpi = callPackage ../os-specific/linux/system76-acpi { };
system76-power = callPackage ../os-specific/linux/system76-power { };
system76-io = callPackage ../os-specific/linux/system76-io { };
tmon = callPackage ../os-specific/linux/tmon { };