From dc3ea58abcb6404cdcad082f2ccd9c0d24e56925 Mon Sep 17 00:00:00 2001 From: Alexandre Acebedo Date: Fri, 16 Sep 2022 19:23:46 +0200 Subject: [PATCH] supergfxctl: init at 5.0.1 --- .../system/supergfxctl/default.nix | 45 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 47 insertions(+) create mode 100644 pkgs/applications/system/supergfxctl/default.nix diff --git a/pkgs/applications/system/supergfxctl/default.nix b/pkgs/applications/system/supergfxctl/default.nix new file mode 100644 index 000000000000..f1a88e39e4e7 --- /dev/null +++ b/pkgs/applications/system/supergfxctl/default.nix @@ -0,0 +1,45 @@ +{ lib +, rustPlatform +, fetchFromGitLab +, pkg-config +, systemd +}: + +rustPlatform.buildRustPackage rec { + pname = "supergfxctl"; + version = "5.0.1"; + + src = fetchFromGitLab { + owner = "asus-linux"; + repo = "supergfxctl"; + rev = version; + hash = "sha256-4q+7F8s6y+oDkBUKIBBsXZ2EtADcChdnjmABjBUnH9k="; + }; + + cargoSha256 = "sha256-nfs9sUq9569qXsC7JYMzrRPdQQm/l4HZANlG7827K8o="; + + 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 = "A GPU switching utility, mostly for ASUS laptops"; + homepage = "https://gitlab.com/asus-linux/supergfxctl"; + license = licenses.mpl20; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.k900 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7f30247a59c4..706d99e74a55 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3330,6 +3330,8 @@ with pkgs; sshs = callPackage ../development/tools/sshs { }; + supergfxctl = callPackage ../applications/system/supergfxctl { }; + titaniumenv = callPackage ../development/mobile/titaniumenv { }; abootimg = callPackage ../development/mobile/abootimg {};