From ac67bdb5e0dc458e445d8795da6d155f62254ca3 Mon Sep 17 00:00:00 2001 From: dawn Date: Wed, 14 Oct 2026 04:30:29 +0300 Subject: [PATCH] nix: let the localinfra app link cargo builds on macos Signed-off-by: dawn --- flake.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flake.nix b/flake.nix index 9f4ff2eeb..0f3ffeb51 100644 --- a/flake.nix +++ b/flake.nix @@ -683,6 +683,7 @@ runtimeInputs = with pkgs; [process-compose postgresql_14 caddy dnsmasq dnsutils curl jq git nodejs_22 yarn openssl packages'.hydrant-bin nixpkgs-pds.legacyPackages.${system}.bluesky-pds] ++ lib.optionals stdenv.hostPlatform.isLinux [socat slirp4netns util-linux iproute2 iptables procps gawk qemu_kvm e2fsprogs patchelf] + ++ lib.optionals stdenv.hostPlatform.isDarwin [stdenv.cc] ++ lib.concatMap (name: let file = ./localinfra/pc/services + "/${name}/packages"; in @@ -695,6 +696,12 @@ # only macos ships the sqlite the libsqlite3 tag needs export CGO_CFLAGS="-I${packages'.sqlite-lib}/include''${CGO_CFLAGS:+ $CGO_CFLAGS}" export CGO_LDFLAGS="-L${packages'.sqlite-lib}/lib''${CGO_LDFLAGS:+ $CGO_LDFLAGS}" + ${pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' + # .cargo/config.toml names the static shell's prefixed cc, which this app doesn't have + export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=cc + # rusqlite links the system sqlite, which the nix toolchain can't see + export LIBRARY_PATH="${packages'.sqlite-lib}/lib''${LIBRARY_PATH:+:$LIBRARY_PATH}" + ''} ${pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux '' export OPENSSL_INCLUDE_DIR=${pkgs.openssl.dev}/include export OPENSSL_LIB_DIR=${pkgs.openssl.out}/lib -- 2.51.2