lol

postgresql: implement opt-in JIT support

Closes #150801

Note: I decided against resuming directly on #150801 because the
conflict was too big (and resolving it seemed too error-prone to me).
Also the `this`-refactoring could be done in an easier manner, i.e. by
exposing JIT attributes with the correct configuration. More on that
below.

This patch creates variants of the `postgresql*`-packages with JIT[1]
support. Please note that a lot of the work was derived from previous
patches filed by other contributors, namely dasJ, andir and abbradar,
hence the co-authored-by tags below.

Effectively, the following things have changed:

* For JIT variants an LLVM-backed stdenv with clang is now used as
suggested by dasJ[2]. We need LLVM and CLang[3] anyways to build the
JIT-part, so no need to mix this up with GCC's stdenv. Also, using the
`dev`-output of LLVM and clang's stdenv for building (and adding llvm
libs as build-inputs) seems more cross friendly to me (which will
become useful when cross-building for JIT-variants will actually be
supported).

* Plugins inherit the build flags from the Makefiles in
`$out/lib/pgxs/src` (e.g. `-Werror=unguarded-availability-new`). Since
some of the flags are clang-specific (and stem from the use of the
CLang stdenv) and don't work on gcc, the stdenv of `pkgs.postgresql`
is passed to the plugins. I.e., plugins for non-JIT variants are built
with a gcc stdenv on Linux and plugins for JIT variants with a clang
stdenv.

Since `plv8` hard-codes `gcc` as `$CC` in its Makefile[4], I marked it
as broken for JIT-variants of postgresql only.

* Added a test-matrix to confirm that JIT works fine on each
`pkgs.postgresql_*_jit` (thanks Andi for the original test in
#124804!).

* For each postgresql version, a new attribute
`postgresql_<version>_jit` (and a corresponding
`postgresqlPackages<version>JitPackages`) are now exposed for better
discoverability and prebuilt artifacts in the binary cache.

* In #150801 the `this`-argument was replaced by an internal recursion.
I decided against this approach because it'd blow up the diff even
more which makes the readability way harder and also harder to revert
this if necessary.

Instead, it is made sure that `this` always points to the correct
variant of `postgresql` and re-using that in an additional
`.override {}`-expression is trivial because the JIT-variant is
exposed in `all-packages.nix`.

* I think the changes are sufficiently big to actually add myself as
maintainer here.

* Added `libxcrypt` to `buildInputs` for versions <v13. While
building things with an LLVM stdenv, these versions complained that
the extern `crypt()` symbol can't be found. Not sure what this is
exactly about, but since we want to switch to libxcrypt for `crypt()`
usage anyways[5] I decided to add it. For >=13 it's not relevant
anymore anyways[6].

* JIT support doesn't work with cross-compilation. It is attempted to
build LLVM-bytecode (`%.bc` is the corresponding `make(1)`-rule) for
each sub-directory in `backend/` for the JIT apparently, but with a
$(CLANG) that can produce binaries for the build, not the host-platform.

I managed to get a cross-build with JIT support working with
`depsBuildBuild = [ llvmPackages.clang ] ++ buildInputs`, but
considering that the resulting LLVM IR isn't platform-independent this
doesn't give you much. In fact, I tried to test the result in a VM-test,
but as soon as JIT was used to optimize a query, postgres would
coredump with `Illegal instruction`.

A common concern of the original approach - with llvm as build input -
was the massive increase of closure size. With the new approach of using
the LLVM stdenv directly and patching out references to the clang drv in
`$out` the effective closure size changes are:

$ nix path-info -Sh $(nix-build -A postgresql_14)
/nix/store/kssxxqycwa3c7kmwmykwxqvspxxa6r1w-postgresql-14.7 306.4M
$ nix path-info -Sh $(nix-build -A postgresql_14_jit)
/nix/store/xc7qmgqrn4h5yr4vmdwy56gs4bmja9ym-postgresql-14.7 689.2M

Most of the increase in closure-size stems from the `lib`-output of
LLVM

$ nix path-info -Sh /nix/store/5r97sbs5j6mw7qnbg8nhnq1gad9973ap-llvm-11.1.0-lib
/nix/store/5r97sbs5j6mw7qnbg8nhnq1gad9973ap-llvm-11.1.0-lib 349.8M

which is why this shouldn't be enabled by default.

While this is quite much because of LLVM, it's still a massive
improvement over the simple approach of adding llvm/clang as
build-inputs and building with `--with-llvm`:

$ nix path-info -Sh $(nix-build -E '
with import ./. {};
postgresql.overrideAttrs ({ configureFlags ? [], buildInputs ? [], ... }: {
configureFlags = configureFlags ++ [ "--with-llvm" ];
buildInputs = buildInputs ++ [ llvm clang ];
})' -j0)
/nix/store/i3bd2r21c6c3428xb4gavjnplfqxn27p-postgresql-14.7 1.6G

Co-authored-by: Andreas Rammhold <andreas@rammhold.de>
Co-authored-by: Janne Heß <janne@hess.ooo>
Co-authored-by: Nikolay Amiantov <ab@fmap.me>

[1] https://www.postgresql.org/docs/current/jit-reason.html
[2] https://github.com/NixOS/nixpkgs/pull/124804#issuecomment-864616931
& https://github.com/NixOS/nixpkgs/pull/150801#issuecomment-1467868321
[3] This fails with the following error otherwise:
```
configure: error: clang not found, but required when compiling --with-llvm, specify with CLANG=
```
[4] https://github.com/plv8/plv8/blob/v3.1.5/Makefile#L14
[5] https://github.com/NixOS/nixpkgs/pull/181764
[6] https://github.com/postgres/postgres/commit/c45643d618e35ec2fe91438df15abd4f3c0d85ca

+227 -64
+11
nixos/doc/manual/release-notes/rl-2305.section.md
··· 249 249 250 250 - `services.chronyd` is now started with additional systemd sandbox/hardening options for better security. 251 251 252 + - PostgreSQL has opt-in support for [JIT compilation](https://www.postgresql.org/docs/current/jit-reason.html). It can be enabled like this: 253 + ```nix 254 + { 255 + services.postgresql = { 256 + enable = true; 257 + package = pkgs.postgresql_jit; 258 + settings."jit" = "on"; 259 + }; 260 + } 261 + ``` 262 + 252 263 - `services.dhcpcd` service now don't solicit or accept IPv6 Router Advertisements on interfaces that use static IPv6 addresses. 253 264 254 265 - The module `services.headscale` was refactored to be compliant with [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md). To be precise, this means that the following things have changed:
+1
nixos/tests/all-tests.nix
··· 561 561 postfixadmin = handleTest ./postfixadmin.nix {}; 562 562 postgis = handleTest ./postgis.nix {}; 563 563 postgresql = handleTest ./postgresql.nix {}; 564 + postgresql-jit = handleTest ./postgresql-jit.nix {}; 564 565 postgresql-wal-receiver = handleTest ./postgresql-wal-receiver.nix {}; 565 566 powerdns = handleTest ./powerdns.nix {}; 566 567 powerdns-admin = handleTest ./powerdns-admin.nix {};
+50
nixos/tests/postgresql-jit.nix
··· 1 + { system ? builtins.currentSystem 2 + , config ? {} 3 + , pkgs ? import ../.. { inherit system config; } 4 + }: 5 + 6 + with import ../lib/testing-python.nix { inherit system pkgs; }; 7 + 8 + let 9 + inherit (pkgs) lib; 10 + packages = lib.filter 11 + (lib.hasSuffix "_jit") 12 + (builtins.attrNames (import ../../pkgs/servers/sql/postgresql pkgs)); 13 + 14 + mkJitTest = packageName: makeTest { 15 + name = "${packageName}"; 16 + meta.maintainers = with lib.maintainers; [ ma27 ]; 17 + nodes.machine = { pkgs, lib, ... }: { 18 + services.postgresql = { 19 + enable = true; 20 + package = pkgs.${packageName}; 21 + settings.jit = "on"; 22 + initialScript = pkgs.writeText "init.sql" '' 23 + create table demo (id int); 24 + insert into demo (id) select generate_series(1, 5); 25 + ''; 26 + }; 27 + }; 28 + testScript = '' 29 + machine.start() 30 + machine.wait_for_unit("postgresql.service") 31 + 32 + with subtest("JIT is enabled"): 33 + machine.succeed("sudo -u postgres psql <<<'show jit;' | grep 'on'") 34 + 35 + with subtest("Test JIT works fine"): 36 + output = machine.succeed( 37 + "cat ${pkgs.writeText "test.sql" '' 38 + set jit_above_cost = 1; 39 + EXPLAIN ANALYZE SELECT CONCAT('jit result = ', SUM(id)) FROM demo; 40 + SELECT CONCAT('jit result = ', SUM(id)) from demo; 41 + ''} | sudo -u postgres psql" 42 + ) 43 + assert "JIT:" in output 44 + assert "jit result = 15" in output 45 + 46 + machine.shutdown() 47 + ''; 48 + }; 49 + in 50 + lib.genAttrs packages mkJitTest
+1 -1
nixos/tests/postgresql-wal-receiver.nix
··· 116 116 }; 117 117 118 118 # Maps the generic function over all attributes of PostgreSQL packages 119 - in builtins.listToAttrs (map makePostgresqlWalReceiverTest (builtins.attrNames (import ../../pkgs/servers/sql/postgresql { }))) 119 + in builtins.listToAttrs (map makePostgresqlWalReceiverTest (builtins.attrNames (import ../../pkgs/servers/sql/postgresql pkgs)))
+149 -62
pkgs/servers/sql/postgresql/default.nix
··· 14 14 , this, self, newScope, buildEnv 15 15 16 16 # source specification 17 - , version, hash, psqlSchema, 17 + , version, hash, psqlSchema 18 18 19 19 # for tests 20 - nixosTests, thisAttr 20 + , nixosTests, thisAttr 21 + 22 + # JIT 23 + , jitSupport ? false 24 + , nukeReferences, patchelf, llvmPackages 25 + , makeRustPlatform, buildPgxExtension, rustPlatform 26 + 27 + # detection of crypt fails when using llvm stdenv, so we add it manually 28 + # for <13 (where it got removed: https://github.com/postgres/postgres/commit/c45643d618e35ec2fe91438df15abd4f3c0d85ca) 29 + , libxcrypt 21 30 }: 22 31 let 23 32 atLeast = lib.versionAtLeast version; 33 + olderThan = lib.versionOlder version; 24 34 lz4Enabled = atLeast "14"; 25 35 zstdEnabled = atLeast "15"; 26 36 27 - in stdenv.mkDerivation rec { 37 + stdenv' = if jitSupport then llvmPackages.stdenv else stdenv; 38 + in stdenv'.mkDerivation rec { 28 39 pname = "postgresql"; 29 40 inherit version; 30 41 ··· 33 44 inherit hash; 34 45 }; 35 46 36 - hardeningEnable = lib.optionals (!stdenv.cc.isClang) [ "pie" ]; 47 + hardeningEnable = lib.optionals (!stdenv'.cc.isClang) [ "pie" ]; 37 48 38 49 outputs = [ "out" "lib" "doc" "man" ]; 39 50 setOutputFlags = false; # $out retains configureFlags :-/ ··· 45 56 libxml2 46 57 icu 47 58 ] 59 + ++ lib.optionals (olderThan "13") [ libxcrypt ] 60 + ++ lib.optionals jitSupport [ llvmPackages.llvm ] 48 61 ++ lib.optionals lz4Enabled [ lz4 ] 49 62 ++ lib.optionals zstdEnabled [ zstd ] 50 63 ++ lib.optionals enableSystemd [ systemd ] 51 64 ++ lib.optionals gssSupport [ libkrb5 ] 52 - ++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ]; 65 + ++ lib.optionals (!stdenv'.isDarwin) [ libossp_uuid ]; 53 66 54 67 nativeBuildInputs = [ 55 68 makeWrapper 56 69 pkg-config 57 - ]; 70 + ] 71 + ++ lib.optionals jitSupport [ llvmPackages.llvm.dev nukeReferences patchelf ]; 58 72 59 - enableParallelBuilding = !stdenv.isDarwin; 73 + enableParallelBuilding = !stdenv'.isDarwin; 60 74 61 75 separateDebugInfo = true; 62 76 ··· 65 79 env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2"; 66 80 67 81 # Otherwise it retains a reference to compiler and fails; see #44767. TODO: better. 68 - preConfigure = "CC=${stdenv.cc.targetPrefix}cc"; 82 + preConfigure = "CC=${stdenv'.cc.targetPrefix}cc"; 69 83 70 84 configureFlags = [ 71 85 "--with-openssl" ··· 76 90 "--with-system-tzdata=${tzdata}/share/zoneinfo" 77 91 "--enable-debug" 78 92 (lib.optionalString enableSystemd "--with-systemd") 79 - (if stdenv.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid") 93 + (if stdenv'.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid") 80 94 ] ++ lib.optionals lz4Enabled [ "--with-lz4" ] 81 95 ++ lib.optionals zstdEnabled [ "--with-zstd" ] 82 96 ++ lib.optionals gssSupport [ "--with-gssapi" ] 83 - ++ lib.optionals stdenv.hostPlatform.isRiscV [ "--disable-spinlocks" ]; 97 + ++ lib.optionals stdenv'.hostPlatform.isRiscV [ "--disable-spinlocks" ] 98 + ++ lib.optionals jitSupport [ "--with-llvm" ]; 84 99 85 100 patches = [ 86 101 ./patches/disable-resolve_symlinks.patch ··· 88 103 ./patches/hardcode-pgxs-path.patch 89 104 ./patches/specify_pkglibdir_at_runtime.patch 90 105 ./patches/findstring.patch 91 - ] ++ lib.optionals stdenv.isLinux [ 106 + ] ++ lib.optionals stdenv'.isLinux [ 92 107 (if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch) 93 108 ]; 94 109 ··· 99 114 postPatch = '' 100 115 # Hardcode the path to pgxs so pg_config returns the path in $out 101 116 substituteInPlace "src/common/config_info.c" --replace HARDCODED_PGXS_PATH "$out/lib" 117 + 118 + ${lib.optionalString jitSupport '' 119 + # Force lookup of jit stuff in $out instead of $lib 120 + substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\" 121 + substituteInPlace src/backend/jit/llvm/llvmjit.c --replace pkglib_path \"$out/lib\" 122 + substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_path \"$out/lib\" 123 + ''} 102 124 ''; 103 125 104 126 postInstall = ··· 109 131 moveToOutput "lib/libecpg*" "$out" 110 132 111 133 # Prevent a retained dependency on gcc-wrapper. 112 - substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld 134 + substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv'.cc}/bin/ld ld 113 135 114 136 if [ -z "''${dontDisableStatic:-}" ]; then 115 137 # Remove static libraries in case dynamic are available. 116 138 for i in $out/lib/*.a $lib/lib/*.a; do 117 139 name="$(basename "$i")" 118 - ext="${stdenv.hostPlatform.extensions.sharedLibrary}" 140 + ext="${stdenv'.hostPlatform.extensions.sharedLibrary}" 119 141 if [ -e "$lib/lib/''${name%.a}$ext" ] || [ -e "''${i%.a}$ext" ]; then 120 142 rm "$i" 121 143 fi 122 144 done 123 145 fi 146 + 147 + ${lib.optionalString jitSupport '' 148 + # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that 149 + # depends on libpq.so will also have libLLVM.so in its closure too, bloating it 150 + moveToOutput "lib/bitcode" "$out" 151 + moveToOutput "lib/llvmjit*" "$out" 152 + 153 + # In the case of JIT support, prevent a retained dependency on clang-wrapper 154 + substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang 155 + nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f) 156 + 157 + # Stop out depending on the default output of llvm 158 + substituteInPlace $out/lib/pgxs/src/Makefile.global \ 159 + --replace ${self.llvmPackages.llvm.out}/bin "" \ 160 + --replace '$(LLVM_BINPATH)/' "" 161 + 162 + # Stop out depending on the -dev output of llvm 163 + substituteInPlace $out/lib/pgxs/src/Makefile.global \ 164 + --replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \ 165 + --replace -I${self.llvmPackages.llvm.dev}/include "" 166 + 167 + # Stop lib depending on the -dev output of llvm 168 + rpath=$(patchelf --print-rpath $out/lib/llvmjit.so) 169 + nuke-refs -e $out $out/lib/llvmjit.so 170 + # Restore the correct rpath 171 + patchelf $out/lib/llvmjit.so --set-rpath "$rpath" 172 + ''} 124 173 ''; 125 174 126 - postFixup = lib.optionalString (!stdenv.isDarwin && stdenv.hostPlatform.libc == "glibc") 175 + postFixup = lib.optionalString (!stdenv'.isDarwin && stdenv'.hostPlatform.libc == "glibc") 127 176 '' 128 177 # initdb needs access to "locale" command from glibc. 129 178 wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin 130 179 ''; 131 180 132 - doCheck = !stdenv.isDarwin; 181 + doCheck = !stdenv'.isDarwin; 133 182 # autodetection doesn't seem to able to find this, but it's there. 134 183 checkTarget = "check"; 135 184 ··· 138 187 # ! ERROR: could not load library "/build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by /build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so) 139 188 # See also here: 140 189 # https://git.alpinelinux.org/aports/tree/main/postgresql/disable-broken-tests.patch?id=6d7d32c12e073a57a9e5946e55f4c1fbb68bd442 141 - if stdenv.hostPlatform.isMusl then '' 190 + if stdenv'.hostPlatform.isMusl then '' 142 191 substituteInPlace src/test/regress/parallel_schedule \ 143 192 --replace "subscription" "" \ 144 193 --replace "object_address" "" ··· 146 195 147 196 doInstallCheck = false; # needs a running daemon? 148 197 149 - disallowedReferences = [ stdenv.cc ]; 198 + disallowedReferences = [ stdenv'.cc ]; 150 199 151 200 passthru = { 152 - inherit readline psqlSchema; 201 + inherit readline psqlSchema jitSupport; 153 202 154 203 pkgs = let 155 - scope = { postgresql = this; }; 204 + scope = { 205 + postgresql = this; 206 + stdenv = stdenv'; 207 + buildPgxExtension = buildPgxExtension.override { 208 + stdenv = stdenv'; 209 + rustPlatform = makeRustPlatform { 210 + stdenv = stdenv'; 211 + inherit (rustPlatform.rust) rustc cargo; 212 + }; 213 + }; 214 + }; 156 215 newSelf = self // scope; 157 216 newSuper = { callPackage = newScope (scope // this.pkgs); }; 158 217 in import ./packages.nix newSelf newSuper; ··· 163 222 } 164 223 this.pkgs; 165 224 166 - tests.postgresql = nixosTests.postgresql-wal-receiver.${thisAttr}; 225 + tests = { 226 + postgresql = nixosTests.postgresql-wal-receiver.${thisAttr}; 227 + } // lib.optionalAttrs jitSupport { 228 + postgresql-jit = nixosTests.postgresql-jit.${thisAttr}; 229 + }; 230 + } // lib.optionalAttrs jitSupport { 231 + inherit (llvmPackages) llvm; 167 232 }; 168 233 169 234 meta = with lib; { 170 235 homepage = "https://www.postgresql.org"; 171 236 description = "A powerful, open source object-relational database system"; 172 237 license = licenses.postgresql; 173 - maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ]; 238 + maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ma27 ]; 174 239 platforms = platforms.unix; 240 + 241 + # JIT support doesn't work with cross-compilation. It is attempted to build LLVM-bytecode 242 + # (`%.bc` is the corresponding `make(1)`-rule) for each sub-directory in `backend/` for 243 + # the JIT apparently, but with a $(CLANG) that can produce binaries for the build, not the 244 + # host-platform. 245 + # 246 + # I managed to get a cross-build with JIT support working with 247 + # `depsBuildBuild = [ llvmPackages.clang ] ++ buildInputs`, but considering that the 248 + # resulting LLVM IR isn't platform-independent this doesn't give you much. 249 + # In fact, I tried to test the result in a VM-test, but as soon as JIT was used to optimize 250 + # a query, postgres would coredump with `Illegal instruction`. 251 + broken = jitSupport && (stdenv.hostPlatform != stdenv.buildPlatform); 175 252 }; 176 253 }; 177 254 ··· 204 281 passthru.psqlSchema = postgresql.psqlSchema; 205 282 }; 206 283 207 - in self: { 284 + mkPackages = self: { 285 + postgresql_11 = self.callPackage generic { 286 + version = "11.19"; 287 + psqlSchema = "11.1"; # should be 11, but changing it is invasive 288 + hash = "sha256-ExCeK3HxE5QFwnIB2jczphrOcu4cIo2cnwMg4GruFMI="; 289 + this = self.postgresql_11; 290 + thisAttr = "postgresql_11"; 291 + inherit self; 292 + }; 208 293 209 - postgresql_11 = self.callPackage generic { 210 - version = "11.19"; 211 - psqlSchema = "11.1"; # should be 11, but changing it is invasive 212 - hash = "sha256-ExCeK3HxE5QFwnIB2jczphrOcu4cIo2cnwMg4GruFMI="; 213 - this = self.postgresql_11; 214 - thisAttr = "postgresql_11"; 215 - inherit self; 216 - }; 294 + postgresql_12 = self.callPackage generic { 295 + version = "12.14"; 296 + psqlSchema = "12"; 297 + hash = "sha256-eFYQI304LIQtNW40cTjljAb/6uJA5swLUqxevMMNBD4="; 298 + this = self.postgresql_12; 299 + thisAttr = "postgresql_12"; 300 + inherit self; 301 + }; 217 302 218 - postgresql_12 = self.callPackage generic { 219 - version = "12.14"; 220 - psqlSchema = "12"; 221 - hash = "sha256-eFYQI304LIQtNW40cTjljAb/6uJA5swLUqxevMMNBD4="; 222 - this = self.postgresql_12; 223 - thisAttr = "postgresql_12"; 224 - inherit self; 225 - }; 303 + postgresql_13 = self.callPackage generic { 304 + version = "13.10"; 305 + psqlSchema = "13"; 306 + hash = "sha256-W7z1pW2FxE86iwWPtGhi/0nLyRg00H4pXQLm3jwhbfI="; 307 + this = self.postgresql_13; 308 + thisAttr = "postgresql_13"; 309 + inherit self; 310 + }; 226 311 227 - postgresql_13 = self.callPackage generic { 228 - version = "13.10"; 229 - psqlSchema = "13"; 230 - hash = "sha256-W7z1pW2FxE86iwWPtGhi/0nLyRg00H4pXQLm3jwhbfI="; 231 - this = self.postgresql_13; 232 - thisAttr = "postgresql_13"; 233 - inherit self; 234 - }; 312 + postgresql_14 = self.callPackage generic { 313 + version = "14.7"; 314 + psqlSchema = "14"; 315 + hash = "sha256-zvYPAJj6gQHBVG9CVORbcir1QxM3lFs3ryBwB2MNszE="; 316 + this = self.postgresql_14; 317 + thisAttr = "postgresql_14"; 318 + inherit self; 319 + }; 235 320 236 - postgresql_14 = self.callPackage generic { 237 - version = "14.7"; 238 - psqlSchema = "14"; 239 - hash = "sha256-zvYPAJj6gQHBVG9CVORbcir1QxM3lFs3ryBwB2MNszE="; 240 - this = self.postgresql_14; 241 - thisAttr = "postgresql_14"; 242 - inherit self; 321 + postgresql_15 = self.callPackage generic { 322 + version = "15.2"; 323 + psqlSchema = "15"; 324 + hash = "sha256-maIXH8PWtbX1a3V6ejy4XVCaOOQnOAXe8jlB7SuEaMc="; 325 + this = self.postgresql_15; 326 + thisAttr = "postgresql_15"; 327 + inherit self; 328 + }; 243 329 }; 244 330 245 - postgresql_15 = self.callPackage generic { 246 - version = "15.2"; 247 - psqlSchema = "15"; 248 - hash = "sha256-maIXH8PWtbX1a3V6ejy4XVCaOOQnOAXe8jlB7SuEaMc="; 249 - this = self.postgresql_15; 250 - thisAttr = "postgresql_15"; 251 - inherit self; 252 - }; 253 - } 331 + in self: 332 + let packages = mkPackages self; in 333 + packages 334 + // self.lib.mapAttrs' 335 + (attrName: postgres: self.lib.nameValuePair "${attrName}_jit" (postgres.override rec { 336 + jitSupport = true; 337 + thisAttr = "${attrName}_jit"; 338 + this = self.${thisAttr}; 339 + })) 340 + packages
+1
pkgs/servers/sql/postgresql/ext/plv8/default.nix
··· 138 138 maintainers = with maintainers; [ marsam ]; 139 139 platforms = [ "x86_64-linux" ]; 140 140 license = licenses.postgresql; 141 + broken = postgresql.jitSupport; 141 142 }; 142 143 })
+1 -1
pkgs/servers/sql/postgresql/ext/postgis.nix
··· 26 26 27 27 buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ] 28 28 ++ lib.optional stdenv.isDarwin libiconv; 29 - nativeBuildInputs = [ perl pkg-config ]; 29 + nativeBuildInputs = [ perl pkg-config ] ++ lib.optional postgresql.jitSupport postgresql.llvm; 30 30 dontDisableStatic = true; 31 31 32 32 # postgis config directory assumes /include /lib from the same root for json-c library
+13
pkgs/top-level/all-packages.nix
··· 25444 25444 postgresql_13 25445 25445 postgresql_14 25446 25446 postgresql_15 25447 + 25448 + postgresql_11_jit 25449 + postgresql_12_jit 25450 + postgresql_13_jit 25451 + postgresql_14_jit 25452 + postgresql_15_jit 25447 25453 ; 25448 25454 postgresql = postgresql_14.override { this = postgresql; }; 25455 + postgresql_jit = postgresql_14_jit.override { this = postgresql_jit; }; 25449 25456 postgresqlPackages = recurseIntoAttrs postgresql.pkgs; 25457 + postgresqlJitPackages = recurseIntoAttrs postgresql_jit.pkgs; 25450 25458 postgresql11Packages = recurseIntoAttrs postgresql_11.pkgs; 25451 25459 postgresql12Packages = recurseIntoAttrs postgresql_12.pkgs; 25452 25460 postgresql13Packages = recurseIntoAttrs postgresql_13.pkgs; 25453 25461 postgresql15Packages = recurseIntoAttrs postgresql_15.pkgs; 25462 + postgresql11JitPackages = recurseIntoAttrs postgresql_11_jit.pkgs; 25463 + postgresql12JitPackages = recurseIntoAttrs postgresql_12_jit.pkgs; 25464 + postgresql13JitPackages = recurseIntoAttrs postgresql_13_jit.pkgs; 25465 + postgresql14JitPackages = recurseIntoAttrs postgresql_14_jit.pkgs; 25466 + postgresql15JitPackages = recurseIntoAttrs postgresql_15_jit.pkgs; 25454 25467 postgresql14Packages = postgresqlPackages; 25455 25468 25456 25469 postgresql_jdbc = callPackage ../development/java-modules/postgresql_jdbc { };