jenkins: 2.479.3 -> 2.492.1
[NixPkgs.git] / pkgs / by-name / as / asusctl / package.nix
blob3ff9cfb714ddcd4d5c002f3e6c51d2e1e49d5639
2   lib,
3   rustPlatform,
4   fetchFromGitLab,
5   systemd,
6   coreutils,
7   gnugrep,
8   pkg-config,
9   fontconfig,
10   libGL,
11   libinput,
12   libxkbcommon,
13   libgbm,
14   seatd,
15   wayland,
16   glibc,
18 rustPlatform.buildRustPackage rec {
19   pname = "asusctl";
20   version = "6.1.1";
22   src = fetchFromGitLab {
23     owner = "asus-linux";
24     repo = "asusctl";
25     rev = version;
26     hash = "sha256-E2c4KhwLGAgorq4cHdPt/j45ebL0k+A/ktkXh71utxA=";
27   };
29   useFetchCargoVendor = true;
30   cargoHash = "sha256-o+u4k6yGVThBO9Chv4EwVpkDZzZj64RN9iNZyAy0LHs=";
32   postPatch = ''
33     files="
34       asusd-user/src/config.rs
35       asusd-user/src/daemon.rs
36       asusd/src/aura_anime/config.rs
37       rog-aura/src/aura_detection.rs
38       rog-control-center/src/lib.rs
39       rog-control-center/src/main.rs
40       rog-control-center/src/tray.rs
41     "
42     for file in $files; do
43       substituteInPlace $file --replace-fail /usr/share $out/share
44     done
46     substituteInPlace data/asusd.rules --replace-fail systemctl ${lib.getExe' systemd "systemctl"}
47     substituteInPlace data/asusd.service \
48       --replace-fail /usr/bin/asusd $out/bin/asusd \
49       --replace-fail /bin/sleep ${lib.getExe' coreutils "sleep"}
50     substituteInPlace data/asusd-user.service \
51       --replace-fail /usr/bin/asusd-user $out/bin/asusd-user \
52       --replace-fail /usr/bin/sleep ${lib.getExe' coreutils "sleep"}
54     substituteInPlace Makefile \
55       --replace-fail /usr/bin/grep ${lib.getExe gnugrep}
57     substituteInPlace /build/asusctl-${version}-vendor/sg-0.4.0/build.rs \
58       --replace-fail /usr/include ${lib.getDev glibc}/include
59   '';
61   nativeBuildInputs = [
62     pkg-config
63     rustPlatform.bindgenHook
64   ];
66   buildInputs = [
67     fontconfig
68     libGL
69     libinput
70     libxkbcommon
71     libgbm
72     seatd
73     systemd
74     wayland
75   ];
77   # force linking to all the dlopen()ed dependencies
78   RUSTFLAGS = map (a: "-C link-arg=${a}") [
79     "-Wl,--push-state,--no-as-needed"
80     "-lEGL"
81     "-lfontconfig"
82     "-lwayland-client"
83     "-Wl,--pop-state"
84   ];
86   # upstream has minimal tests, so don't rebuild twice
87   doCheck = false;
89   postInstall = ''
90     make prefix=$out install-data
92     patchelf $out/bin/rog-control-center \
93       --add-needed ${lib.getLib libxkbcommon}/lib/libxkbcommon.so.0
94   '';
96   meta = with lib; {
97     description = "Control daemon, CLI tools, and a collection of crates for interacting with ASUS ROG laptops";
98     homepage = "https://gitlab.com/asus-linux/asusctl";
99     license = licenses.mpl20;
100     platforms = [ "x86_64-linux" ];
101     maintainers = with maintainers; [
102       k900
103       aacebedo
104     ];
105   };