Skip to content

Commit 5443540

Browse files
committed
Refactoring and build pg_graphql 1.0.2 using pgx 0.6.1
1 parent 89a1cca commit 5443540

File tree

9 files changed

+3976
-41
lines changed

9 files changed

+3976
-41
lines changed

nix/cargo-pgrx/buildPgrxExtension.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
buildFeatures ? [ ],
5454
cargoBuildFlags ? [ ],
5555
postgresql,
56+
# enable override to generate bindings using bindgenHook.
57+
# Some older versions of cargo-pgrx use a bindgenHook that is not compatible with the
58+
# current clang version present in stdenv
59+
bindgenHook ? rustPlatform.bindgenHook,
5660
# cargo-pgrx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the
5761
# dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g.
5862
# if you include the generated code in the output via postInstall.
@@ -129,6 +133,7 @@ let
129133
cargo-pgrx
130134
postgresql
131135
pkg-config
136+
bindgenHook
132137
]
133138
++ lib.optionals useFakeRustfmt [ fakeRustfmt ];
134139

nix/cargo-pgrx/default.nix

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ let
2020
hash,
2121
cargoHash,
2222
}:
23-
let
24-
pname = if builtins.compareVersions "0.7.4" version >= 0 then
25-
"cargo-pgx"
26-
else
27-
"cargo-pgrx";
23+
let
24+
pname = if builtins.compareVersions "0.7.4" version >= 0 then "cargo-pgx" else "cargo-pgrx";
2825
in
2926
rustPlatform.buildRustPackage rec {
3027
# rust-overlay uses 'cargo-auditable' wrapper for 'cargo' command, but it
@@ -36,16 +33,10 @@ let
3633
inherit version;
3734
src = fetchCrate { inherit version pname hash; };
3835
inherit cargoHash;
39-
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
40-
pkg-config
41-
];
36+
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
4237
buildInputs =
43-
lib.optionals stdenv.hostPlatform.isLinux [
44-
openssl
45-
]
46-
++ lib.optionals stdenv.hostPlatform.isDarwin [
47-
darwin.apple_sdk.frameworks.Security
48-
];
38+
lib.optionals stdenv.hostPlatform.isLinux [ openssl ]
39+
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
4940

5041
OPENSSL_DIR = "${openssl.dev}";
5142
OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";

nix/cargo-pgrx/mkPgrxExtension.nix

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@
66
rust-bin,
77
}:
88
let
9-
inherit
10-
(
11-
(callPackage ./default.nix {
12-
inherit rustVersion;
13-
})
14-
)
15-
mkCargoPgrx
16-
;
9+
inherit ((callPackage ./default.nix { inherit rustVersion; })) mkCargoPgrx;
1710

1811
rustPlatform = makeRustPlatform {
1912
cargo = rust-bin.stable.${rustVersion}.default;

nix/checks.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,10 @@
309309
;
310310
}
311311
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
312-
pg_graphql = import ./ext/tests/pg_graphql.nix { inherit self; inherit pkgs; };
312+
pg_graphql = import ./ext/tests/pg_graphql.nix {
313+
inherit self;
314+
inherit pkgs;
315+
};
313316
wrappers = import ./ext/tests/wrappers.nix {
314317
inherit self;
315318
inherit pkgs;

0 commit comments

Comments
 (0)