Skip to content

Commit d34a5b5

Browse files
tgunnoeladamesny
authored andcommitted
fix: add flag for build on macos
1 parent e4517e5 commit d34a5b5

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

flake.nix

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
(pkgs.lib.hasSuffix ".json" path);
5555
};
5656

57-
# Build inputs
5857
buildInputs = with pkgs; [
5958
openssl
6059
libclang.lib
@@ -65,7 +64,6 @@
6564
pkgs.darwin.apple_sdk.frameworks.Security
6665
];
6766

68-
# Native build inputs
6967
nativeBuildInputs = with pkgs; [
7068
pkg-config
7169
protobuf
@@ -74,15 +72,15 @@
7472

7573
# Environment variables
7674
CC_ENABLE_DEBUG_OUTPUT = "1";
75+
CRATE_CC_NO_DEFAULTS = 1;
7776
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
7877
rustToolchain
7978
pkgs.stdenv.cc.cc
8079
pkgs.libz
8180
pkgs.clang
8281
];
8382

84-
# Bindgen configuration
85-
BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.clang.cc.lib}/lib/clang/19/include";
83+
BINDGEN_EXTRA_CLANG_ARGS = if pkgs.lib.hasSuffix "linux" system then "-I${pkgs.glibc.dev}/include -I${pkgs.clang.cc.lib}/lib/clang/19/include" else "";
8684
LIBCLANG_PATH = "${pkgs.clang.cc.lib}/lib";
8785

8886
# Platform-specific flags
@@ -102,12 +100,9 @@
102100
OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include";
103101
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
104102

105-
# Platform-specific RUSTFLAGS
106103
RUSTFLAGS = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin
107104
"--cfg unwinding_backport --cfg unwinding_apple";
108105

109-
# Git commit hash for Substrate CLI
110-
SUBSTRATE_CLI_GIT_COMMIT_HASH = self.dirtyShortRev or self.shortRev;
111106
};
112107

113108
# Build the workspace dependencies
@@ -121,8 +116,10 @@
121116
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
122117

123118
inherit cargoArtifacts;
119+
120+
# Git commit hash for Substrate CLI
121+
SUBSTRATE_CLI_GIT_COMMIT_HASH = self.dirtyShortRev or self.shortRev;
124122

125-
# Post-fixup for Linux
126123
postFixup = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
127124
patchelf --set-rpath "${pkgs.rocksdb}/lib:${pkgs.stdenv.cc.cc.lib}/lib" $out/bin/partner-chains-demo-node
128125
'';

0 commit comments

Comments
 (0)