Skip to content

Commit 4597a9c

Browse files
committed
fix(nix): make nix run work on darwin
This injects `libiconv` at runtime in the env var `DYLD_LIBRARY_PATH`, fixing `nix run .#` on MacOS. Thanks to @fjahr that reported the issue and submitted a PR. This PR is very similar, but injects `libiconv` only on the end binary.
1 parent 0397678 commit 4597a9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cli/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ in stdenv.mkDerivation {
8282
makeWrapper ${hax}/bin/cargo-hax $out/bin/cargo-hax \
8383
--prefix PATH : ${lib.makeBinPath binaries} \
8484
${
85-
if stdenv.hostPlatform.isDarwin then
86-
"--suffix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath [ libz rustc ]}"
87-
else
88-
""
85+
lib.optionalString stdenv.isDarwin ''
86+
--prefix RUSTFLAGS : "-C link-arg=-L${libiconv}/lib" \
87+
--suffix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath [ libz rustc ]}
88+
''
8989
}
9090
'';
9191
meta.mainProgram = "cargo-hax";

0 commit comments

Comments
 (0)