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`.
pull/5373/head
Michael Davis 2 years ago committed by GitHub
parent febe1a5172
commit d6704ed117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,7 +82,8 @@
packages = with common.pkgs; packages = with common.pkgs;
[lld_13 cargo-flamegraph rust-analyzer] [lld_13 cargo-flamegraph rust-analyzer]
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin) ++ (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 = [ env = [
{ {
name = "HELIX_RUNTIME"; name = "HELIX_RUNTIME";
@ -94,10 +95,10 @@
} }
{ {
name = "RUSTFLAGS"; name = "RUSTFLAGS";
value = eval =
if common.pkgs.stdenv.isLinux if common.pkgs.stdenv.isLinux
then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment" then "$RUSTFLAGS\" -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment\""
else ""; else "$RUSTFLAGS";
} }
]; ];
}; };

Loading…
Cancel
Save