on master help sign in
flake: Fix devshell for darwin hosts (#5368)

Runs of `cargo build` would fail with `ld: framework not found CoreFoundation` inside a devshell (`nix develop`) on a Darwin host. This is fixed with two changes: * Including the `CoreFoundation` package within the devshell's derivation. * Switching from `value` to `eval` so that we append to the `RUSTFLAGS` environment variable rather than overwriting it. `numtide/devshell` already exposes the `Library/Frameworks` path within the devshell derivation but it was being overwritten by the manual setting of `RUSTFLAGS` in `env`.

commitd6704ed11735283a777d0980afa29dc201765fdd authorMichael Davis <mcarsondavis@gmail.com> dateMon 2 Jan 2023, 10:12 (4 years ago) parentfebe1a5
1 file changed+5−4
flake.nix+5−4
flake.nix+5−4
@@ -82,7 +82,8 @@
8282 packages = with common.pkgs;
8383 [lld_13 cargo-flamegraph rust-analyzer]
8484 ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
85− ++ (lib.optional stdenv.isLinux lldb);
85+ ++ (lib.optional stdenv.isLinux lldb)
86+ ++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
8687 env = [
8788 {
8889 name = "HELIX_RUNTIME";
@@ -94,10 +95,10 @@
9495 }
9596 {
9697 name = "RUSTFLAGS";
97− value =
98+ eval =
9899 if common.pkgs.stdenv.isLinux
99− then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
100− else "";
100+ then "$RUSTFLAGS\" -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment\""
101+ else "$RUSTFLAGS";
101102 }
102103 ];
103104 };