depot/third_party/nixpkgs/pkgs/applications/system/supergfxctl/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

45 lines
1.2 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitLab
, pkg-config
, systemd
}:
rustPlatform.buildRustPackage rec {
pname = "supergfxctl";
version = "5.2.1";
src = fetchFromGitLab {
owner = "asus-linux";
repo = "supergfxctl";
rev = version;
hash = "sha256-gjMLyT3pvQhmjz9SFbYlDAqg+tCX5ORkCkcnyBzO5ws=";
};
cargoHash = "sha256-ndugyiAYPDyue2Ajxx22BNvYc9iBTxZqP5OxaqmC7U0=";
postPatch = ''
substituteInPlace data/supergfxd.service --replace /usr/bin/supergfxd $out/bin/supergfxd
substituteInPlace data/99-nvidia-ac.rules --replace /usr/bin/systemctl ${systemd}/bin/systemctl
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ systemd ];
# upstream doesn't have tests, don't build twice just to find that out
doCheck = false;
postInstall = ''
install -Dm444 -t $out/lib/udev/rules.d/ data/*.rules
install -Dm444 -t $out/share/dbus-1/system.d/ data/org.supergfxctl.Daemon.conf
install -Dm444 -t $out/lib/systemd/system/ data/supergfxd.service
'';
meta = with lib; {
description = "GPU switching utility, mostly for ASUS laptops";
homepage = "https://gitlab.com/asus-linux/supergfxctl";
license = licenses.mpl20;
platforms = [ "x86_64-linux" ];
maintainers = [ maintainers.k900 ];
};
}