nix: include darwin deps inside devShell, too

Summary: Without `devShell` providing the needed Darwin-specific inputs, `cargo
build` does not work inside a `nix develop` or `direnv` environment; libgit2 in
particular fails on being able to find the Security framework.

The actual `nix build` invocation however *does* work because we correctly
include those dependencies in the package `buildInputs`. So just factor them
out, and use them in both places.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I484bf381ca31c29c4c39fb6d184bdd21
This commit is contained in:
Austin Seipp 2023-11-04 14:18:34 -05:00
parent 5fc649cbee
commit 2401bf9bcd

View File

@ -42,6 +42,13 @@
cargo = rust-version; cargo = rust-version;
}; };
# these are needed in both devShell and buildInputs
darwinDeps = with pkgs; lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
libiconv
];
in in
{ {
packages = { packages = {
@ -68,11 +75,7 @@
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
openssl zstd libgit2 libssh2 openssl zstd libgit2 libssh2
] ++ lib.optionals stdenv.isDarwin [ ] ++ darwinDeps;
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
libiconv
];
ZSTD_SYS_USE_PKG_CONFIG = "1"; ZSTD_SYS_USE_PKG_CONFIG = "1";
LIBSSH2_SYS_USE_PKG_CONFIG = "1"; LIBSSH2_SYS_USE_PKG_CONFIG = "1";
@ -129,7 +132,7 @@
# For building the documentation website # For building the documentation website
poetry poetry
]; ] ++ darwinDeps;
shellHook = '' shellHook = ''
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1