Skip to content

Commit ca5b7e8

Browse files
committed
fix: bindgen
1 parent ff60110 commit ca5b7e8

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

nix/ext/pg_graphql/default.nix

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ let
5050
env = lib.optionalAttrs stdenv.isDarwin {
5151
POSTGRES_LIB = "${postgresql}/lib";
5252
RUSTFLAGS = "-C link-arg=-undefined -C link-arg=dynamic_lookup";
53-
NIX_BUILD_CORES = "4"; # Limit parallel jobs
54-
CARGO_BUILD_JOBS = "4"; # Limit cargo parallelism
53+
NIX_BUILD_CORES = "4";
54+
CARGO_BUILD_JOBS = "4";
5555
};
56+
5657
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG = true;
5758

5859
postInstall = ''
@@ -92,22 +93,30 @@ let
9293
inherit (postgresql.meta) platforms;
9394
};
9495
}
95-
// lib.optionalAttrs (builtins.compareVersions "1.4.4" version >= 0) {
96-
# Fix bindgen error on aarch64-linux by using an older version of clang
97-
bindgenHook =
98-
let
99-
nixos2211 = (
100-
import (builtins.fetchTarball {
101-
url = "https://channels.nixos.org/nixos-22.11/nixexprs.tar.xz";
102-
sha256 = "1j7h75a9hwkkm97jicky5rhvzkdwxsv5v46473rl6agvq2sj97y1";
103-
}) { inherit system; }
104-
);
105-
in
106-
rustPlatform.bindgenHook.overrideAttrs {
107-
libclang = nixos2211.clang.cc.lib;
108-
clang = nixos2211.clang;
109-
};
110-
}
96+
//
97+
lib.optionalAttrs
98+
(
99+
# Fix bindgen error on aarch64-linux for versions using pgrx with bindgen 0.68.1
100+
# This affects pgrx 0.6.1 through 0.11.3 which have issues with ARM NEON vector ABI
101+
# We apply the fix to all versions up to and including 1.5.7 (last version before 1.5.9 which uses 0.12.6)
102+
builtins.compareVersions "1.5.7" version >= 0
103+
)
104+
{
105+
# Fix bindgen error on aarch64-linux by using an older version of clang
106+
bindgenHook =
107+
let
108+
nixos2211 = (
109+
import (builtins.fetchTarball {
110+
url = "https://channels.nixos.org/nixos-22.11/nixexprs.tar.xz";
111+
sha256 = "1j7h75a9hwkkm97jicky5rhvzkdwxsv5v46473rl6agvq2sj97y1";
112+
}) { inherit system; }
113+
);
114+
in
115+
rustPlatform.bindgenHook.overrideAttrs {
116+
libclang = nixos2211.clang.cc.lib;
117+
clang = nixos2211.clang;
118+
};
119+
}
111120
// lib.optionalAttrs (builtins.compareVersions "1.2.0" version >= 0) {
112121
# Add missing Cargo.lock
113122
patches = [ ./0001-Add-missing-Cargo.lock-${version}.patch ];

0 commit comments

Comments
 (0)