File tree Expand file tree Collapse file tree 3 files changed +23
-27
lines changed Expand file tree Collapse file tree 3 files changed +23
-27
lines changed Original file line number Diff line number Diff line change 34
34
stdenv ,
35
35
darwin ,
36
36
writeShellScriptBin ,
37
+ defaultBindgenHook ,
37
38
} :
38
39
39
40
# The idea behind: Use it mostly like rustPlatform.buildRustPackage and so
56
57
# enable override to generate bindings using bindgenHook.
57
58
# Some older versions of cargo-pgrx use a bindgenHook that is not compatible with the
58
59
# current clang version present in stdenv
59
- bindgenHook ? rustPlatform . bindgenHook ,
60
+ bindgenHook ? defaultBindgenHook ,
60
61
# cargo-pgrx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the
61
62
# dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g.
62
63
# if you include the generated code in the output via postInstall.
Original file line number Diff line number Diff line change 4
4
pgrxVersion ,
5
5
makeRustPlatform ,
6
6
rust-bin ,
7
+ system ,
7
8
} :
8
9
let
9
10
inherit ( ( callPackage ./default.nix { inherit rustVersion ; } ) ) mkCargoPgrx ;
31
32
inherit ( mapping ) hash cargoHash ;
32
33
version = pgrxVersion ;
33
34
} ;
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 ;
34
54
in
35
55
callPackage ./buildPgrxExtension.nix {
36
56
inherit rustPlatform ;
37
57
inherit cargo-pgrx ;
58
+ defaultBindgenHook = bindgenHook ;
38
59
}
Original file line number Diff line number Diff line change 7
7
postgresql ,
8
8
rust-bin ,
9
9
rsync ,
10
- system ,
11
- rustPlatform ,
12
10
} :
13
11
14
12
let
104
102
inherit ( postgresql . meta ) platforms ;
105
103
} ;
106
104
}
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
- }
131
105
// lib . optionalAttrs ( builtins . compareVersions "1.2.0" version >= 0 ) {
132
106
# Add missing Cargo.lock
133
107
patches = [ ./0001-Add-missing-Cargo.lock-${ version } .patch ] ;
You can’t perform that action at this time.
0 commit comments