lol

Merge pull request #221851 from Ma27/postgresql-jit-support

postgresql: implement opt-in JIT support

authored by

Sandro and committed by
GitHub
c2ae278e dcd028c9

+290 -73
+10
nixos/doc/manual/release-notes/rl-2305.section.md
··· 273 273 274 274 - `services.chronyd` is now started with additional systemd sandbox/hardening options for better security. 275 275 276 + - PostgreSQL has opt-in support for [JIT compilation](https://www.postgresql.org/docs/current/jit-reason.html). It can be enabled like this: 277 + ```nix 278 + { 279 + services.postgresql = { 280 + enable = true; 281 + enableJIT = true; 282 + }; 283 + } 284 + ``` 285 + 276 286 - `services.dhcpcd` service now don't solicit or accept IPv6 Router Advertisements on interfaces that use static IPv6 addresses. 277 287 278 288 - 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:
+37
nixos/modules/services/databases/postgresql.md
··· 171 171 }; 172 172 } 173 173 ``` 174 + 175 + ## JIT (Just-In-Time compilation) {#module-services-postgres-jit} 176 + 177 + [JIT](https://www.postgresql.org/docs/current/jit-reason.html)-support in the PostgreSQL package 178 + is disabled by default because of the ~300MiB closure-size increase from the LLVM dependency. It 179 + can be optionally enabled in PostgreSQL with the following config option: 180 + 181 + ```nix 182 + { 183 + services.postgresql.enableJIT = true; 184 + } 185 + ``` 186 + 187 + This makes sure that the [`jit`](https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT)-setting 188 + is set to `on` and a PostgreSQL package with JIT enabled is used. Further tweaking of the JIT compiler, e.g. setting a different 189 + query cost threshold via [`jit_above_cost`](https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT-ABOVE-COST) 190 + can be done manually via [`services.postgresql.settings`](#opt-services.postgresql.settings). 191 + 192 + The attribute-names of JIT-enabled PostgreSQL packages are suffixed with `_jit`, i.e. for each `pkgs.postgresql` 193 + (and `pkgs.postgresql_<major>`) in `nixpkgs` there's also a `pkgs.postgresql_jit` (and `pkgs.postgresql_<major>_jit`). 194 + Alternatively, a JIT-enabled variant can be derived from a given `postgresql` package via `postgresql.withJIT`. 195 + This is also useful if it's not clear which attribute from `nixpkgs` was originally used (e.g. when working with 196 + [`config.services.postgresql.package`](#opt-services.postgresql.package) or if the package was modified via an 197 + overlay) since all modifications are propagated to `withJIT`. I.e. 198 + 199 + ```nix 200 + with import <nixpkgs> { 201 + overlays = [ 202 + (self: super: { 203 + postgresql = super.postgresql.overrideAttrs (_: { pname = "foobar"; }); 204 + }) 205 + ]; 206 + }; 207 + postgresql.withJIT.pname 208 + ``` 209 + 210 + evaluates to `"foobar"`.
+20 -7
nixos/modules/services/databases/postgresql.nix
··· 7 7 cfg = config.services.postgresql; 8 8 9 9 postgresql = 10 + let 11 + # ensure that 12 + # services.postgresql = { 13 + # enableJIT = true; 14 + # package = pkgs.postgresql_<major>; 15 + # }; 16 + # works. 17 + base = if cfg.enableJIT && !cfg.package.jitSupport then cfg.package.withJIT else cfg.package; 18 + in 10 19 if cfg.extraPlugins == [] 11 - then cfg.package 12 - else cfg.package.withPackages (_: cfg.extraPlugins); 20 + then base 21 + else base.withPackages (_: cfg.extraPlugins); 13 22 14 23 toStr = value: 15 24 if true == value then "yes" ··· 41 50 services.postgresql = { 42 51 43 52 enable = mkEnableOption (lib.mdDoc "PostgreSQL Server"); 53 + 54 + enableJIT = mkEnableOption (lib.mdDoc "JIT support"); 44 55 45 56 package = mkOption { 46 57 type = types.package; ··· 435 446 log_line_prefix = cfg.logLinePrefix; 436 447 listen_addresses = if cfg.enableTCPIP then "*" else "localhost"; 437 448 port = cfg.port; 449 + jit = mkDefault (if cfg.enableJIT then "on" else "off"); 438 450 }; 439 451 440 452 services.postgresql.package = let 441 453 mkThrow = ver: throw "postgresql_${ver} was removed, please upgrade your postgresql version."; 454 + base = if versionAtLeast config.system.stateVersion "22.05" then pkgs.postgresql_14 455 + else if versionAtLeast config.system.stateVersion "21.11" then pkgs.postgresql_13 456 + else if versionAtLeast config.system.stateVersion "20.03" then pkgs.postgresql_11 457 + else if versionAtLeast config.system.stateVersion "17.09" then mkThrow "9_6" 458 + else mkThrow "9_5"; 442 459 in 443 460 # Note: when changing the default, make it conditional on 444 461 # ‘system.stateVersion’ to maintain compatibility with existing 445 462 # systems! 446 - mkDefault (if versionAtLeast config.system.stateVersion "22.05" then pkgs.postgresql_14 447 - else if versionAtLeast config.system.stateVersion "21.11" then pkgs.postgresql_13 448 - else if versionAtLeast config.system.stateVersion "20.03" then pkgs.postgresql_11 449 - else if versionAtLeast config.system.stateVersion "17.09" then mkThrow "9_6" 450 - else mkThrow "9_5"); 463 + mkDefault (if cfg.enableJIT then base.withJIT else base); 451 464 452 465 services.postgresql.dataDir = mkDefault "/var/lib/postgresql/${cfg.package.psqlSchema}"; 453 466
+1
nixos/tests/all-tests.nix
··· 565 565 postfixadmin = handleTest ./postfixadmin.nix {}; 566 566 postgis = handleTest ./postgis.nix {}; 567 567 postgresql = handleTest ./postgresql.nix {}; 568 + postgresql-jit = handleTest ./postgresql-jit.nix {}; 568 569 postgresql-wal-receiver = handleTest ./postgresql-wal-receiver.nix {}; 569 570 powerdns = handleTest ./powerdns.nix {}; 570 571 powerdns-admin = handleTest ./powerdns-admin.nix {};
+48
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 = builtins.attrNames (import ../../pkgs/servers/sql/postgresql pkgs); 11 + 12 + mkJitTest = packageName: makeTest { 13 + name = "${packageName}"; 14 + meta.maintainers = with lib.maintainers; [ ma27 ]; 15 + nodes.machine = { pkgs, lib, ... }: { 16 + services.postgresql = { 17 + enable = true; 18 + enableJIT = true; 19 + package = pkgs.${packageName}; 20 + initialScript = pkgs.writeText "init.sql" '' 21 + create table demo (id int); 22 + insert into demo (id) select generate_series(1, 5); 23 + ''; 24 + }; 25 + }; 26 + testScript = '' 27 + machine.start() 28 + machine.wait_for_unit("postgresql.service") 29 + 30 + with subtest("JIT is enabled"): 31 + machine.succeed("sudo -u postgres psql <<<'show jit;' | grep 'on'") 32 + 33 + with subtest("Test JIT works fine"): 34 + output = machine.succeed( 35 + "cat ${pkgs.writeText "test.sql" '' 36 + set jit_above_cost = 1; 37 + EXPLAIN ANALYZE SELECT CONCAT('jit result = ', SUM(id)) FROM demo; 38 + SELECT CONCAT('jit result = ', SUM(id)) from demo; 39 + ''} | sudo -u postgres psql" 40 + ) 41 + assert "JIT:" in output 42 + assert "jit result = 15" in output 43 + 44 + machine.shutdown() 45 + ''; 46 + }; 47 + in 48 + 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)))
+1 -1
nixos/tests/postgresql.nix
··· 137 137 maintainers = [ zagy ]; 138 138 }; 139 139 140 - machine = {...}: 140 + nodes.machine = {...}: 141 141 { 142 142 services.postgresql = { 143 143 enable = true;
+157 -63
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 + '' + lib.optionalString jitSupport '' 118 + # Force lookup of jit stuff in $out instead of $lib 119 + substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\" 120 + substituteInPlace src/backend/jit/llvm/llvmjit.c --replace pkglib_path \"$out/lib\" 121 + substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_path \"$out/lib\" 102 122 ''; 103 123 104 124 postInstall = ··· 109 129 moveToOutput "lib/libecpg*" "$out" 110 130 111 131 # Prevent a retained dependency on gcc-wrapper. 112 - substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld 132 + substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv'.cc}/bin/ld ld 113 133 114 134 if [ -z "''${dontDisableStatic:-}" ]; then 115 135 # Remove static libraries in case dynamic are available. 116 136 for i in $out/lib/*.a $lib/lib/*.a; do 117 137 name="$(basename "$i")" 118 - ext="${stdenv.hostPlatform.extensions.sharedLibrary}" 138 + ext="${stdenv'.hostPlatform.extensions.sharedLibrary}" 119 139 if [ -e "$lib/lib/''${name%.a}$ext" ] || [ -e "''${i%.a}$ext" ]; then 120 140 rm "$i" 121 141 fi 122 142 done 123 143 fi 144 + '' + lib.optionalString jitSupport '' 145 + # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that 146 + # depends on libpq.so will also have libLLVM.so in its closure too, bloating it 147 + moveToOutput "lib/bitcode" "$out" 148 + moveToOutput "lib/llvmjit*" "$out" 149 + 150 + # In the case of JIT support, prevent a retained dependency on clang-wrapper 151 + substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang 152 + nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f) 153 + 154 + # Stop out depending on the default output of llvm 155 + substituteInPlace $out/lib/pgxs/src/Makefile.global \ 156 + --replace ${self.llvmPackages.llvm.out}/bin "" \ 157 + --replace '$(LLVM_BINPATH)/' "" 158 + 159 + # Stop out depending on the -dev output of llvm 160 + substituteInPlace $out/lib/pgxs/src/Makefile.global \ 161 + --replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \ 162 + --replace -I${self.llvmPackages.llvm.dev}/include "" 163 + 164 + ${lib.optionalString (!stdenv'.isDarwin) '' 165 + # Stop lib depending on the -dev output of llvm 166 + rpath=$(patchelf --print-rpath $out/lib/llvmjit.so) 167 + nuke-refs -e $out $out/lib/llvmjit.so 168 + # Restore the correct rpath 169 + patchelf $out/lib/llvmjit.so --set-rpath "$rpath" 170 + ''} 124 171 ''; 125 172 126 - postFixup = lib.optionalString (!stdenv.isDarwin && stdenv.hostPlatform.libc == "glibc") 173 + postFixup = lib.optionalString (!stdenv'.isDarwin && stdenv'.hostPlatform.libc == "glibc") 127 174 '' 128 175 # initdb needs access to "locale" command from glibc. 129 176 wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin 130 177 ''; 131 178 132 - doCheck = !stdenv.isDarwin; 179 + doCheck = !stdenv'.isDarwin; 133 180 # autodetection doesn't seem to able to find this, but it's there. 134 181 checkTarget = "check"; 135 182 ··· 138 185 # ! 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 186 # See also here: 140 187 # https://git.alpinelinux.org/aports/tree/main/postgresql/disable-broken-tests.patch?id=6d7d32c12e073a57a9e5946e55f4c1fbb68bd442 141 - if stdenv.hostPlatform.isMusl then '' 188 + if stdenv'.hostPlatform.isMusl then '' 142 189 substituteInPlace src/test/regress/parallel_schedule \ 143 190 --replace "subscription" "" \ 144 191 --replace "object_address" "" ··· 146 193 147 194 doInstallCheck = false; # needs a running daemon? 148 195 149 - disallowedReferences = [ stdenv.cc ]; 196 + disallowedReferences = [ stdenv'.cc ]; 197 + 198 + passthru = let 199 + jitToggle = this.override { 200 + jitSupport = !jitSupport; 201 + this = jitToggle; 202 + }; 203 + in 204 + { 205 + inherit readline psqlSchema jitSupport; 150 206 151 - passthru = { 152 - inherit readline psqlSchema; 207 + withJIT = if jitSupport then this else jitToggle; 208 + withoutJIT = if jitSupport then jitToggle else this; 153 209 154 210 pkgs = let 155 - scope = { postgresql = this; }; 211 + scope = { 212 + postgresql = this; 213 + stdenv = stdenv'; 214 + buildPgxExtension = buildPgxExtension.override { 215 + stdenv = stdenv'; 216 + rustPlatform = makeRustPlatform { 217 + stdenv = stdenv'; 218 + inherit (rustPlatform.rust) rustc cargo; 219 + }; 220 + }; 221 + }; 156 222 newSelf = self // scope; 157 223 newSuper = { callPackage = newScope (scope // this.pkgs); }; 158 224 in import ./packages.nix newSelf newSuper; ··· 163 229 } 164 230 this.pkgs; 165 231 166 - tests.postgresql = nixosTests.postgresql-wal-receiver.${thisAttr}; 232 + tests = { 233 + postgresql = nixosTests.postgresql-wal-receiver.${thisAttr}; 234 + } // lib.optionalAttrs jitSupport { 235 + postgresql-jit = nixosTests.postgresql-jit.${thisAttr}; 236 + }; 237 + } // lib.optionalAttrs jitSupport { 238 + inherit (llvmPackages) llvm; 167 239 }; 168 240 169 241 meta = with lib; { 170 242 homepage = "https://www.postgresql.org"; 171 243 description = "A powerful, open source object-relational database system"; 172 244 license = licenses.postgresql; 173 - maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ]; 245 + maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ma27 ]; 174 246 platforms = platforms.unix; 247 + 248 + # JIT support doesn't work with cross-compilation. It is attempted to build LLVM-bytecode 249 + # (`%.bc` is the corresponding `make(1)`-rule) for each sub-directory in `backend/` for 250 + # the JIT apparently, but with a $(CLANG) that can produce binaries for the build, not the 251 + # host-platform. 252 + # 253 + # I managed to get a cross-build with JIT support working with 254 + # `depsBuildBuild = [ llvmPackages.clang ] ++ buildInputs`, but considering that the 255 + # resulting LLVM IR isn't platform-independent this doesn't give you much. 256 + # In fact, I tried to test the result in a VM-test, but as soon as JIT was used to optimize 257 + # a query, postgres would coredump with `Illegal instruction`. 258 + broken = jitSupport && (stdenv.hostPlatform != stdenv.buildPlatform); 175 259 }; 176 260 }; 177 261 ··· 204 288 passthru.psqlSchema = postgresql.psqlSchema; 205 289 }; 206 290 207 - in self: { 291 + mkPackages = self: { 292 + postgresql_11 = self.callPackage generic { 293 + version = "11.19"; 294 + psqlSchema = "11.1"; # should be 11, but changing it is invasive 295 + hash = "sha256-ExCeK3HxE5QFwnIB2jczphrOcu4cIo2cnwMg4GruFMI="; 296 + this = self.postgresql_11; 297 + thisAttr = "postgresql_11"; 298 + inherit self; 299 + }; 208 300 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 - }; 301 + postgresql_12 = self.callPackage generic { 302 + version = "12.14"; 303 + psqlSchema = "12"; 304 + hash = "sha256-eFYQI304LIQtNW40cTjljAb/6uJA5swLUqxevMMNBD4="; 305 + this = self.postgresql_12; 306 + thisAttr = "postgresql_12"; 307 + inherit self; 308 + }; 217 309 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 - }; 310 + postgresql_13 = self.callPackage generic { 311 + version = "13.10"; 312 + psqlSchema = "13"; 313 + hash = "sha256-W7z1pW2FxE86iwWPtGhi/0nLyRg00H4pXQLm3jwhbfI="; 314 + this = self.postgresql_13; 315 + thisAttr = "postgresql_13"; 316 + inherit self; 317 + }; 226 318 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 - }; 319 + postgresql_14 = self.callPackage generic { 320 + version = "14.7"; 321 + psqlSchema = "14"; 322 + hash = "sha256-zvYPAJj6gQHBVG9CVORbcir1QxM3lFs3ryBwB2MNszE="; 323 + this = self.postgresql_14; 324 + thisAttr = "postgresql_14"; 325 + inherit self; 326 + }; 235 327 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; 328 + postgresql_15 = self.callPackage generic { 329 + version = "15.2"; 330 + psqlSchema = "15"; 331 + hash = "sha256-maIXH8PWtbX1a3V6ejy4XVCaOOQnOAXe8jlB7SuEaMc="; 332 + this = self.postgresql_15; 333 + thisAttr = "postgresql_15"; 334 + inherit self; 335 + }; 243 336 }; 244 337 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 - } 338 + in self: 339 + let packages = mkPackages self; in 340 + packages 341 + // self.lib.mapAttrs' 342 + (attrName: postgres: self.lib.nameValuePair "${attrName}_jit" (postgres.override rec { 343 + jitSupport = true; 344 + thisAttr = "${attrName}_jit"; 345 + this = self.${thisAttr}; 346 + })) 347 + 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
··· 25473 25473 postgresql_13 25474 25474 postgresql_14 25475 25475 postgresql_15 25476 + 25477 + postgresql_11_jit 25478 + postgresql_12_jit 25479 + postgresql_13_jit 25480 + postgresql_14_jit 25481 + postgresql_15_jit 25476 25482 ; 25477 25483 postgresql = postgresql_14.override { this = postgresql; }; 25484 + postgresql_jit = postgresql_14_jit.override { this = postgresql_jit; }; 25478 25485 postgresqlPackages = recurseIntoAttrs postgresql.pkgs; 25486 + postgresqlJitPackages = recurseIntoAttrs postgresql_jit.pkgs; 25479 25487 postgresql11Packages = recurseIntoAttrs postgresql_11.pkgs; 25480 25488 postgresql12Packages = recurseIntoAttrs postgresql_12.pkgs; 25481 25489 postgresql13Packages = recurseIntoAttrs postgresql_13.pkgs; 25482 25490 postgresql15Packages = recurseIntoAttrs postgresql_15.pkgs; 25491 + postgresql11JitPackages = recurseIntoAttrs postgresql_11_jit.pkgs; 25492 + postgresql12JitPackages = recurseIntoAttrs postgresql_12_jit.pkgs; 25493 + postgresql13JitPackages = recurseIntoAttrs postgresql_13_jit.pkgs; 25494 + postgresql14JitPackages = recurseIntoAttrs postgresql_14_jit.pkgs; 25495 + postgresql15JitPackages = recurseIntoAttrs postgresql_15_jit.pkgs; 25483 25496 postgresql14Packages = postgresqlPackages; 25484 25497 25485 25498 postgresql_jdbc = callPackage ../development/java-modules/postgresql_jdbc { };