|
88 | 88 | pushd "${buildAndTestSubdir}" |
89 | 89 | ''; |
90 | 90 | maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd"; |
| 91 | + pgrxBinaryName = if builtins.compareVersions "0.7.4" cargo-pgrx.version >= 0 then "pgx" else "pgrx"; |
91 | 92 |
|
92 | 93 | pgrxPostgresMajor = lib.versions.major postgresql.version; |
93 | 94 | preBuildAndTest = '' |
94 | 95 | export PGRX_HOME=$(mktemp -d) |
| 96 | + export PGX_HOME=$PGRX_HOME |
95 | 97 | export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/" |
96 | | - cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config |
| 98 | + cargo-${pgrxBinaryName} ${pgrxBinaryName} init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config |
97 | 99 |
|
98 | 100 | # unix sockets work in sandbox, too. |
99 | 101 | export PGHOST="$(mktemp -d)" |
|
128 | 130 | cargo-pgrx |
129 | 131 | postgresql |
130 | 132 | pkg-config |
131 | | - rustPlatform.bindgenHook |
132 | 133 | ] |
133 | 134 | ++ lib.optionals useFakeRustfmt [ fakeRustfmt ]; |
134 | 135 |
|
|
139 | 140 | ${preBuildAndTest} |
140 | 141 | ${maybeEnterBuildAndTestSubdir} |
141 | 142 |
|
142 | | - PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \ |
143 | | - ${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \ |
144 | | - cargo pgrx package \ |
| 143 | + export PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" |
| 144 | + export PGX_BUILD_FLAGS="$PGRX_BUILD_FLAGS" |
| 145 | + ${lib.optionalString true ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \ |
| 146 | + cargo ${pgrxBinaryName} package \ |
145 | 147 | --pg-config ${lib.getDev postgresql}/bin/pg_config \ |
146 | 148 | ${maybeDebugFlag} \ |
147 | 149 | --features "${builtins.concatStringsSep " " buildFeatures}" \ |
|
161 | 163 |
|
162 | 164 | ${maybeEnterBuildAndTestSubdir} |
163 | 165 |
|
164 | | - cargo-pgrx pgrx stop all |
| 166 | + cargo-${pgrxBinaryName} ${pgrxBinaryName} stop all |
165 | 167 |
|
166 | 168 | mv $out/${postgresql}/* $out |
167 | 169 | mv $out/${postgresql.lib}/* $out |
|
0 commit comments