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