Skip to content

Commit

Permalink
flake: Fix devshell for darwin hosts (helix-editor#5368)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
the-mikedavis authored and semin-park committed Jan 4, 2023
1 parent 2b1828a commit fe6bb55
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
packages = with common.pkgs;
[lld_13 cargo-flamegraph rust-analyzer]
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
++ (lib.optional stdenv.isLinux lldb);
++ (lib.optional stdenv.isLinux lldb)
++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
env = [
{
name = "HELIX_RUNTIME";
Expand All @@ -94,10 +95,10 @@
}
{
name = "RUSTFLAGS";
value =
eval =
if common.pkgs.stdenv.isLinux
then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
else "";
then "$RUSTFLAGS\" -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment\""
else "$RUSTFLAGS";
}
];
};
Expand Down

0 comments on commit fe6bb55

Please sign in to comment.