File tree Expand file tree Collapse file tree 4 files changed +25
-25
lines changed Expand file tree Collapse file tree 4 files changed +25
-25
lines changed Original file line number Diff line number Diff line change 3434 stdenv ,
3535 darwin ,
3636 writeShellScriptBin ,
37+ defaultBindgenHook ,
3738} :
3839
3940# The idea behind: Use it mostly like rustPlatform.buildRustPackage and so
5657 # enable override to generate bindings using bindgenHook.
5758 # Some older versions of cargo-pgrx use a bindgenHook that is not compatible with the
5859 # current clang version present in stdenv
59- bindgenHook ? rustPlatform . bindgenHook ,
60+ bindgenHook ? defaultBindgenHook ,
6061 # cargo-pgrx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the
6162 # dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g.
6263 # if you include the generated code in the output via postInstall.
Original file line number Diff line number Diff line change 44 pgrxVersion ,
55 makeRustPlatform ,
66 rust-bin ,
7+ system ,
78} :
89let
910 inherit ( ( callPackage ./default.nix { inherit rustVersion ; } ) ) mkCargoPgrx ;
3132 inherit ( mapping ) hash cargoHash ;
3233 version = pgrxVersion ;
3334 } ;
35+
36+ bindgenHook =
37+ # Fix bindgen error on aarch64-linux for versions using pgrx with bindgen 0.68.1
38+ # This affects pgrx 0.6.1 through 0.11.2 which have issues with ARM NEON vector ABI
39+ if ( builtins . compareVersions "0.11.3" pgrxVersion > 0 ) then
40+ let
41+ nixos2211 = (
42+ import ( builtins . fetchTarball {
43+ url = "https://channels.nixos.org/nixos-22.11/nixexprs.tar.xz" ;
44+ sha256 = "1j7h75a9hwkkm97jicky5rhvzkdwxsv5v46473rl6agvq2sj97y1" ;
45+ } ) { inherit system ; }
46+ ) ;
47+ in
48+ rustPlatform . bindgenHook . overrideAttrs {
49+ libclang = nixos2211 . clang . cc . lib ;
50+ clang = nixos2211 . clang ;
51+ }
52+ else
53+ rustPlatform . bindgenHook ;
3454in
3555callPackage ./buildPgrxExtension.nix {
3656 inherit rustPlatform ;
3757 inherit cargo-pgrx ;
58+ defaultBindgenHook = bindgenHook ;
3859}
Original file line number Diff line number Diff line change 104104 inherit ( postgresql . meta ) platforms ;
105105 } ;
106106 }
107- //
108- lib . optionalAttrs
109- (
110- # Fix bindgen error on aarch64-linux for versions using pgrx with bindgen 0.68.1
111- # This affects pgrx 0.6.1 through 0.11.2 which have issues with ARM NEON vector ABI
112- # We apply the fix to all versions up to 1.5.1 (last version before 1.5.4 which uses 0.11.2)
113- builtins . compareVersions "1.5.4" version > 0
114- )
115- {
116- # Fix bindgen error on aarch64-linux by using an older version of clang
117- bindgenHook =
118- let
119- nixos2211 = (
120- import ( builtins . fetchTarball {
121- url = "https://channels.nixos.org/nixos-22.11/nixexprs.tar.xz" ;
122- sha256 = "1j7h75a9hwkkm97jicky5rhvzkdwxsv5v46473rl6agvq2sj97y1" ;
123- } ) { inherit system ; }
124- ) ;
125- in
126- rustPlatform . bindgenHook . overrideAttrs {
127- libclang = nixos2211 . clang . cc . lib ;
128- clang = nixos2211 . clang ;
129- } ;
130- }
131107 // lib . optionalAttrs ( builtins . compareVersions "1.2.0" version >= 0 ) {
132108 # Add missing Cargo.lock
133109 patches = [ ./0001-Add-missing-Cargo.lock-${ version } .patch ] ;
Original file line number Diff line number Diff line change 66 fetchFromGitHub ,
77 postgresql ,
88 rust-bin ,
9+ system ,
10+ rustPlatform ,
911} :
1012let
1113 pname = "pg_jsonschema" ;
You can’t perform that action at this time.
0 commit comments