From 1036f7a4c782c053673f86bbdbd4422e81176933 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 20 Jan 2025 20:11:39 -0500 Subject: [PATCH] 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 --- pkgs/by-name/la/lact/package.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/la/lact/package.nix b/pkgs/by-name/la/lact/package.nix index e0e4e13d8b21..18a6a0c4c48c 100644 --- a/pkgs/by-name/la/lact/package.nix +++ b/pkgs/by-name/la/lact/package.nix @@ -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 = ''