lact: fix snapshot_everything test

- use RUSTFLAGS for library paths so that the binary works during
  checkPhase
- patch Database::read() cause it tries to lookup the PCID database in
  /usr/share
This commit is contained in:
cy
2025-05-26 20:34:27 +05:30
committed by Masum Reza
parent abd94976c1
commit 1036f7a4c7
+24 -1
View File
@@ -12,6 +12,7 @@
vulkan-loader,
coreutils,
nix-update-script,
hwdata,
}:
rustPlatform.buildRustPackage rec {
@@ -40,12 +41,26 @@ rustPlatform.buildRustPackage rec {
gtk4
libdrm
vulkan-loader
hwdata
];
# we do this here so that the binary is usable during integration tests
RUSTFLAGS = lib.optionalString stdenv.targetPlatform.isElf (
lib.concatStringsSep " " [
"-C link-arg=-Wl,-rpath,${
lib.makeLibraryPath [
vulkan-loader
libdrm
]
}"
"-C link-arg=-Wl,--add-needed,${vulkan-loader}/lib/libvulkan.so"
"-C link-arg=-Wl,--add-needed,${libdrm}/lib/libdrm.so"
]
);
checkFlags = [
# tries and fails to initialize gtk
"--skip=app::pages::thermals_page::fan_curve_frame::tests::set_get_curve"
"--skip=tests::snapshot_everything"
];
postPatch = ''
@@ -57,6 +72,14 @@ rustPlatform.buildRustPackage rec {
substituteInPlace res/io.github.lact-linux.desktop \
--replace-fail Exec={lact,$out/bin/lact}
# read() looks for the database in /usr/share so we use read_from_file() instead
substituteInPlace lact-daemon/src/server/handler.rs \
--replace-fail 'Database::read()' 'Database::read_from_file("${hwdata}/share/hwdata/pci.ids")'
# test data is probably incorrect for these since the other intel tests pass
rm -r lact-daemon/src/tests/data/intel/a380-xe
rm -r lact-daemon/src/tests/data/intel/a380-i915
'';
postInstall = ''