From f1cf61e2bf1db1ff6a3343717406fecc34089d0e Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 8 Oct 2024 00:34:51 -0400 Subject: [PATCH] niri: force linking with linker args instead of patchelf We don't need to be patching an already built binary here --- pkgs/by-name/ni/niri/package.nix | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/ni/niri/package.nix b/pkgs/by-name/ni/niri/package.nix index ea3c2ed972ba..2519fe313489 100644 --- a/pkgs/by-name/ni/niri/package.nix +++ b/pkgs/by-name/ni/niri/package.nix @@ -1,6 +1,5 @@ { lib, - autoPatchelfHook, clang, dbus, fetchFromGitHub, @@ -41,7 +40,6 @@ rustPlatform.buildRustPackage rec { strictDeps = true; nativeBuildInputs = [ - autoPatchelfHook clang pkg-config rustPlatform.bindgenHook @@ -50,6 +48,7 @@ rustPlatform.buildRustPackage rec { buildInputs = [ dbus libdisplay-info + libglvnd # For libEGL libinput libxkbcommon mesa # For libgbm @@ -57,11 +56,7 @@ rustPlatform.buildRustPackage rec { pipewire seatd systemd # Also includes libudev - ]; - - runtimeDependencies = [ - wayland - libglvnd # For libEGL + wayland # For libwayland-client ]; passthru.providedSessions = [ "niri" ]; @@ -79,6 +74,19 @@ rustPlatform.buildRustPackage rec { install -Dm0644 resources/niri{-shutdown.target,.service} -t $out/share/systemd/user ''; + env = { + # Force linking with libEGL and libwayland-client + # so they can be discovered by `dlopen()` + RUSTFLAGS = toString ( + map (arg: "-C link-arg=" + arg) [ + "-Wl,--push-state,--no-as-needed" + "-lEGL" + "-lwayland-client" + "-Wl,--pop-state" + ] + ); + }; + passthru.updateScript = nix-update-script { }; meta = with lib; {