aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2023-01-02 16:12:32 +0000
committerGitHub2023-01-02 16:12:32 +0000
commitd6704ed11735283a777d0980afa29dc201765fdd (patch)
tree628365903445da4369e3e01065ff90011218b014
parentfebe1a5172f346bcb52138e1f9c3d16c212d5a3c (diff)
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`.
-rw-r--r--flake.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/flake.nix b/flake.nix
index fe1c6b44..673f3cf6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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";
@@ -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";
}
];
};