default.nix fixes for macos arm64

This commit is contained in:
Anton-4 2022-08-05 13:31:52 +02:00
parent 510016bf6e
commit f57456fa0e
No known key found for this signature in database
GPG Key ID: A13F4A6E21141925
2 changed files with 11 additions and 2 deletions

6
crates/cli/build.rs Normal file
View File

@ -0,0 +1,6 @@
fn main() {
// workaround for issue https://github.com/NixOS/nixpkgs/issues/166205 . This println can be removed when this issue is fixed. Upgrading to LLVM 14 could also fix this issue.
// also see https://github.com/NixOS/nixpkgs/pull/181485
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
println!("cargo:rustc-link-lib=c++abi")
}

View File

@ -18,7 +18,7 @@ rustPlatform.buildRustPackage {
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
cargoSha256 = "sha256-cFzOcU982kANsZjx4YoLQOZSOYN3loj+5zowhWoBWM8=";
cargoSha256 = "sha256-Pd84GGtW1ecrP03uiCVcybIUtWCSDGfLl+fbbdmFyiE=";
LLVM_SYS_130_PREFIX = "${llvmPkgs.llvm.dev}";
@ -79,8 +79,11 @@ rustPlatform.buildRustPackage {
# cp: to copy str.zig,list.zig...
# wrapProgram pkgs.stdenv.cc: to make ld available for compiler/build/src/link.rs
postInstall = ''
postInstall = if pkgs.stdenv.isLinux then ''
cp -r target/x86_64-unknown-linux-gnu/release/lib/. $out/lib
wrapProgram $out/bin/roc --set NIX_GLIBC_PATH ${nixGlibcPath} --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]}
'' else ''
cp -r target/aarch64-apple-darwin/release/lib/. $out/lib
wrapProgram $out/bin/roc --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]}
'';
}