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:
commit
1956a52857
|
@ -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";
|
||||
|
|
|
@ -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 ];
|
||||
}
|
||||
|
|
30
pkgs/os-specific/linux/system76-power/default.nix
Normal file
30
pkgs/os-specific/linux/system76-power/default.nix
Normal 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 ];
|
||||
};
|
||||
}
|
|
@ -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 { };
|
||||
|
|
Loading…
Reference in a new issue