forked from mirrors/nixpkgs
Merge pull request #237430 from figsoda/lact
This commit is contained in:
commit
8a3054c4f3
80
pkgs/tools/system/lact/default.nix
Normal file
80
pkgs/tools/system/lact/default.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, pkg-config
|
||||
, wrapGAppsHook
|
||||
, gdk-pixbuf
|
||||
, gtk4
|
||||
, libdrm
|
||||
, vulkan-loader
|
||||
, coreutils
|
||||
, hwdata
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "lact";
|
||||
version = "0.4.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ilya-zlobintsev";
|
||||
repo = "LACT";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-zSQqR5AxdqcSwgapSwXYn/36F6SQna8+RS6UTQJySrg=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-DDBYfafLg2fH+HsC5VZzVyRCyVSwcMydUGBe7NQRwEk=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
wrapGAppsHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gdk-pixbuf
|
||||
gtk4
|
||||
libdrm
|
||||
vulkan-loader
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
# tries and fails to initialize gtk
|
||||
"--skip=app::root_stack::thermals_page::fan_curve_frame::tests::set_get_curve"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace lact-daemon/src/server/system.rs \
|
||||
--replace 'Command::new("uname")' 'Command::new("${coreutils}/bin/uname")'
|
||||
|
||||
substituteInPlace res/lactd.service \
|
||||
--replace ExecStart={lact,$out/bin/lact}
|
||||
|
||||
substituteInPlace res/io.github.lact-linux.desktop \
|
||||
--replace Exec={lact,$out/bin/lact}
|
||||
|
||||
pushd $cargoDepsCopy/pciid-parser
|
||||
oldHash=$(sha256sum src/lib.rs | cut -d " " -f 1)
|
||||
sed 's|@hwdata@|${hwdata}|g' < ${./pci-ids.patch} | patch -p1
|
||||
substituteInPlace .cargo-checksum.json \
|
||||
--replace $oldHash $(sha256sum src/lib.rs | cut -d " " -f 1)
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -Dm444 res/lactd.service -t $out/lib/systemd/system
|
||||
install -Dm444 res/io.github.lact-linux.desktop -t $out/share/applications
|
||||
install -Dm444 res/io.github.lact-linux.png -t $out/share/pixmaps
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
patchelf $out/bin/.lact-wrapped \
|
||||
--add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Linux AMDGPU Controller";
|
||||
homepage = "https://github.com/ilya-zlobintsev/LACT";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ figsoda ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
10
pkgs/tools/system/lact/pci-ids.patch
Normal file
10
pkgs/tools/system/lact/pci-ids.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -18,7 +18,7 @@ use std::{
|
||||
};
|
||||
use tracing::trace;
|
||||
|
||||
-const DB_PATHS: &[&str] = &["/usr/share/hwdata/pci.ids", "/usr/share/misc/pci.ids"];
|
||||
+const DB_PATHS: &[&str] = &["@hwdata@/share/hwdata/pci.ids"];
|
||||
#[cfg(feature = "online")]
|
||||
const URL: &str = "https://pci-ids.ucw.cz/v2.2/pci.ids";
|
|
@ -9729,6 +9729,8 @@ with pkgs;
|
|||
|
||||
leatherman = callPackage ../development/libraries/leatherman { };
|
||||
|
||||
lact = callPackage ../tools/system/lact { };
|
||||
|
||||
ledit = callPackage ../tools/misc/ledit {
|
||||
inherit (ocaml-ng.ocamlPackages_4_12) ocaml camlp5;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue