1{ pkg-config, libusb1, dbus, lib, rustPlatform, fetchFromGitHub }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "system76-power";
5 version = "1.1.23";
6
7 src = fetchFromGitHub {
8 owner = "pop-os";
9 repo = "system76-power";
10 rev = version;
11 sha256 = "sha256-RuYDG4eZE599oa04xUR+W5B3/IPOpQUss1x7hzoydUQ=";
12 };
13
14 nativeBuildInputs = [ pkg-config ];
15 buildInputs = [ dbus libusb1 ];
16
17 cargoHash = "sha256-Vps02ZRVmeOQ8jDFZJYAUb502MhqY+2YV2W1/9XGY+0=";
18
19 postInstall = ''
20 install -D -m 0644 data/com.system76.PowerDaemon.conf $out/etc/dbus-1/system.d/com.system76.PowerDaemon.conf
21 install -D -m 0644 data/com.system76.PowerDaemon.policy $out/share/polkit-1/actions/com.system76.PowerDaemon.policy
22 install -D -m 0644 data/com.system76.PowerDaemon.xml $out/share/dbus-1/interfaces/com.system76.PowerDaemon.xml
23 '';
24
25 meta = with lib; {
26 description = "System76 Power Management";
27 mainProgram = "system76-power";
28 homepage = "https://github.com/pop-os/system76-power";
29 license = licenses.gpl3Plus;
30 platforms = [ "i686-linux" "x86_64-linux" ];
31 maintainers = [];
32 };
33}