nixpkgs/pkgs/by-name/as/asusctl/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

103 lines
2.3 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitLab,
systemd,
coreutils,
gnugrep,
pkg-config,
fontconfig,
libGL,
libinput,
libxkbcommon,
mesa,
seatd,
wayland,
}:
rustPlatform.buildRustPackage rec {
pname = "asusctl";
version = "6.0.12";
src = fetchFromGitLab {
owner = "asus-linux";
repo = "asusctl";
rev = version;
hash = "sha256-fod3ZkJktmJGHF8nSSp9lVMg/qYKQd4EiauFGTSvbsg=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"const-field-offset-0.1.5" = "sha256-QtlvLwe27tLLdWhqiKzXoUvBsBcZbfwY84jXUduzCKw=";
"supergfxctl-5.2.4" = "sha256-MQJJaTajPQ45BU6zyMx0Wwf7tAPcT4EURWWbZxrbGzE=";
};
};
postPatch = ''
files="
asusd-user/src/config.rs
asusd-user/src/daemon.rs
asusd/src/ctrl_anime/config.rs
rog-aura/src/aura_detection.rs
rog-control-center/src/lib.rs
rog-control-center/src/main.rs
rog-control-center/src/tray.rs
"
for file in $files; do
substituteInPlace $file --replace /usr/share $out/share
done
substituteInPlace data/asusd.rules --replace systemctl ${systemd}/bin/systemctl
substituteInPlace data/asusd.service \
--replace /usr/bin/asusd $out/bin/asusd \
--replace /bin/sleep ${coreutils}/bin/sleep
substituteInPlace data/asusd-user.service \
--replace /usr/bin/asusd-user $out/bin/asusd-user \
--replace /usr/bin/sleep ${coreutils}/bin/sleep
substituteInPlace Makefile \
--replace /usr/bin/grep ${lib.getExe gnugrep}
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [
fontconfig
libGL
libinput
libxkbcommon
mesa
seatd
systemd
wayland
];
# force linking to all the dlopen()ed dependencies
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lfontconfig"
"-lwayland-client"
"-Wl,--pop-state"
];
# upstream has minimal tests, so don't rebuild twice
doCheck = false;
postInstall = ''
make prefix=$out install-data
'';
meta = with lib; {
description = "Control daemon, CLI tools, and a collection of crates for interacting with ASUS ROG laptops";
homepage = "https://gitlab.com/asus-linux/asusctl";
license = licenses.mpl20;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [
k900
aacebedo
];
};
}