From fb4b956f7c25e72fd4950a61e1a822239e5f4ecd Mon Sep 17 00:00:00 2001
From: pablo
Date: Wed, 15 Apr 2026 13:22:09 +0300
Subject: [PATCH] fix(nix): set @rpath install_name for librln.dylib on mac
---
nix/default.nix | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/nix/default.nix b/nix/default.nix
index c798d6d3..5cb0ea73 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -34,6 +34,11 @@ in targetPlatformPkgs.rustPlatform.buildRustPackage {
buildPhase = ''
export CARGO_HOME=$TMPDIR/cargo
+ '' + pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
+ # Set install_name to @rpath at link time so consumers can dlopen
+ # librln.dylib from any location without post-build fixups.
+ export RUSTFLAGS="''${RUSTFLAGS:-} -C link-arg=-Wl,-install_name,@rpath/librln.dylib"
+ '' + ''
cargo build --lib \
${if release then "--release" else ""} \
${if rust-target != null then "--target=${rust-target}" else ""} \