Skip to content

Commit d6704ed

Browse files
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`.
1 parent febe1a5 commit d6704ed

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

flake.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
};

0 commit comments

Comments
 (0)