Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
'' + ''
Comment on lines 35 to +41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you grep nixpkgs you can see in most cases RUSTFLAGS is just set directly with needing previous value of RUSTFLAGS.

Suggested change
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"
'' + ''
# Set install_name to @rpath at link time so consumers can dlopen
# librln.dylib from any location without post-build fixups.
env.RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-C link-arg=-Wl,-install_name,@rpath/librln.dylib";
buildPhase = ''
export CARGO_HOME=$TMPDIR/cargo

cargo build --lib \
${if release then "--release" else ""} \
${if rust-target != null then "--target=${rust-target}" else ""} \
Expand Down
Loading