1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00

Merge pull request #126656 from jwoudenberg/add-system76-power

This commit is contained in:
Sandro 2021-06-23 12:54:22 +02:00 committed by GitHub
commit 1956a52857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 1 deletions

View file

@ -5206,6 +5206,12 @@
email = "jwilberding@afiniate.com";
name = "Jordan Wilberding";
};
jwoudenberg = {
email = "nixpkgs@jasperwoudenberg.com";
github = "jwoudenberg";
githubId = 1525551;
name = "Jasper Woudenberg";
};
jwygoda = {
email = "jaroslaw@wygoda.me";
github = "jwygoda";

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

@ -20953,6 +20953,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 { };