postgresql_18: init at 18beta1 (#411958)

authored by Wolfgang Walther and committed by GitHub aa038806 b96523cb

+78 -15
+4 -2
nixos/modules/services/databases/postgresql.md
··· 251 251 252 252 Technically, we'd not want to have EOL'ed packages in a stable NixOS release, which is to be supported until one month after the previous release. Thus, with NixOS' release schedule in May and November, the oldest PostgreSQL version in nixpkgs would have to be supported until December. It could be argued that a soon-to-be-EOL-ed version should thus be removed in May for the .05 release already. But since new security vulnerabilities are first disclosed in February of the following year, we agreed on keeping the oldest PostgreSQL major version around one more cycle in [#310580](https://github.com/NixOS/nixpkgs/pull/310580#discussion_r1597284693). 253 253 254 - Thus: 255 - - In September/October the new major version will be released and added to nixos-unstable. 254 + Thus, our release workflow is as follows: 255 + 256 + - In May, `nixpkgs` packages the beta release for an upcoming major version. This is packaged for nixos-unstable only and will not be part of any stable NixOS release. 257 + - In September/October the new major version will be released, replacing the beta package in nixos-unstable. 256 258 - In November the last minor version for the oldest major will be released. 257 259 - Both the current stable .05 release and nixos-unstable should be updated to the latest minor that will usually be released in November. 258 260 - This is relevant for people who need to use this major for as long as possible. In that case its desirable to be able to pin nixpkgs to a commit that still has it, at the latest minor available.
+28 -13
nixos/modules/services/databases/postgresql.nix
··· 43 43 44 44 cfg = config.services.postgresql; 45 45 46 - # ensure that 47 - # services.postgresql = { 48 - # enableJIT = true; 49 - # package = pkgs.postgresql_<major>; 50 - # }; 51 - # works. 52 - basePackage = if cfg.enableJIT then cfg.package.withJIT else cfg.package.withoutJIT; 53 - 54 - postgresql = if cfg.extensions == [ ] then basePackage else basePackage.withPackages cfg.extensions; 55 - 56 46 toStr = 57 47 value: 58 48 if true == value then ··· 72 62 ); 73 63 74 64 configFileCheck = pkgs.runCommand "postgresql-configfile-check" { } '' 75 - ${cfg.package}/bin/postgres -D${configFile} -C config_file >/dev/null 65 + ${cfg.finalPackage}/bin/postgres -D${configFile} -C config_file >/dev/null 76 66 touch $out 77 67 ''; 78 68 79 69 groupAccessAvailable = versionAtLeast cfg.finalPackage.version "11.0"; 80 70 81 - extensionNames = map getName postgresql.installedExtensions; 71 + extensionNames = map getName cfg.finalPackage.installedExtensions; 82 72 extensionInstalled = extension: elem extension extensionNames; 83 73 in 84 74 ··· 143 133 finalPackage = mkOption { 144 134 type = types.package; 145 135 readOnly = true; 146 - default = postgresql; 136 + default = 137 + let 138 + # ensure that 139 + # services.postgresql = { 140 + # enableJIT = true; 141 + # package = pkgs.postgresql_<major>; 142 + # }; 143 + # works. 144 + withJit = if cfg.enableJIT then cfg.package.withJIT else cfg.package.withoutJIT; 145 + withJitAndPackages = if cfg.extensions == [ ] then withJit else withJit.withPackages cfg.extensions; 146 + in 147 + withJitAndPackages; 147 148 defaultText = "with config.services.postgresql; package.withPackages extensions"; 148 149 description = '' 149 150 The postgresql package that will effectively be used in the system. ··· 635 636 ###### implementation 636 637 637 638 config = mkIf cfg.enable { 639 + 640 + warnings = ( 641 + let 642 + unstableState = 643 + if lib.hasInfix "beta" cfg.package.version then 644 + "in beta" 645 + else if lib.hasInfix "rc" cfg.package.version then 646 + "a release candidate" 647 + else 648 + null; 649 + in 650 + lib.optional (unstableState != null) 651 + "PostgreSQL ${lib.versions.major cfg.package.version} is currently ${unstableState}, and is not advised for use in production environments." 652 + ); 638 653 639 654 assertions = map ( 640 655 { name, ensureDBOwnership, ... }:
+11
pkgs/servers/sql/postgresql/18.nix
··· 1 + import ./generic.nix { 2 + version = "18beta1"; 3 + rev = "refs/tags/REL_18_BETA1"; 4 + hash = "sha256-P86bVYfPzkwK/rcvUInYZew/pKejk58/IcnDGx/BWno="; 5 + muslPatches = { 6 + dont-use-locale-a = { 7 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql17/dont-use-locale-a-on-musl.patch?id=d69ead2c87230118ae7f72cef7d761e761e1f37e"; 8 + hash = "sha256-6zjz3OpMx4qTETdezwZxSJPPdOvhCNu9nXvAaU9SwH8="; 9 + }; 10 + }; 11 + }
+1
pkgs/servers/sql/postgresql/default.nix
··· 14 14 postgresql_15 = ./15.nix; 15 15 postgresql_16 = ./16.nix; 16 16 postgresql_17 = ./17.nix; 17 + postgresql_18 = ./18.nix; 17 18 }; 18 19 19 20 mkAttributes =
+31
pkgs/servers/sql/postgresql/generic.nix
··· 58 58 # bonjour 59 59 bonjourSupport ? false, 60 60 61 + # Curl 62 + curlSupport ? 63 + lib.versionAtLeast version "18" 64 + && lib.meta.availableOn stdenv.hostPlatform curl 65 + # Building statically fails with: 66 + # configure: error: library 'curl' does not provide curl_multi_init 67 + # https://www.postgresql.org/message-id/487dacec-6d8d-46c0-a36f-d5b8c81a56f1%40technowledgy.de 68 + && !stdenv.hostPlatform.isStatic, 69 + curl, 70 + 61 71 # GSSAPI 62 72 gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, 63 73 libkrb5, ··· 88 98 nlsSupport ? false, 89 99 gettext, 90 100 101 + # NUMA 102 + numaSupport ? 103 + lib.versionAtLeast version "18" 104 + && lib.meta.availableOn stdenv.hostPlatform numactl 105 + # NUMA can fail in 18beta1 on some hardware with: 106 + # ERROR: invalid NUMA node id outside of allowed range [0, 0]: 1 107 + # https://github.com/NixOS/nixpkgs/pull/411958#issuecomment-3031680123 108 + # https://www.postgresql.org/message-id/flat/E1u1tr8-003BbN-2E%40gemulon.postgresql.org 109 + && version != "18beta1", 110 + numactl, 111 + 91 112 # PAM 92 113 pamSupport ? 93 114 lib.meta.availableOn stdenv.hostPlatform linux-pam ··· 135 156 # Systemd 136 157 systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs, 137 158 systemdLibs, 159 + 160 + # Uring 161 + uringSupport ? lib.versionAtLeast version "18" && lib.meta.availableOn stdenv.hostPlatform liburing, 162 + liburing, 138 163 }@args: 139 164 let 140 165 atLeast = lib.versionAtLeast version; ··· 256 281 ++ lib.optionals lz4Enabled [ lz4 ] 257 282 ++ lib.optionals zstdEnabled [ zstd ] 258 283 ++ lib.optionals systemdSupport [ systemdLibs ] 284 + ++ lib.optionals uringSupport [ liburing ] 285 + ++ lib.optionals curlSupport [ curl ] 286 + ++ lib.optionals numaSupport [ numactl ] 259 287 ++ lib.optionals gssSupport [ libkrb5 ] 260 288 ++ lib.optionals pamSupport [ linux-pam ] 261 289 ++ lib.optionals perlSupport [ perl ] ··· 328 356 ++ lib.optionals (withWalBlocksize != null) [ "--with-wal-blocksize=${toString withWalBlocksize}" ] 329 357 ++ lib.optionals lz4Enabled [ "--with-lz4" ] 330 358 ++ lib.optionals zstdEnabled [ "--with-zstd" ] 359 + ++ lib.optionals uringSupport [ "--with-liburing" ] 360 + ++ lib.optionals curlSupport [ "--with-libcurl" ] 361 + ++ lib.optionals numaSupport [ "--with-libnuma" ] 331 362 ++ lib.optionals gssSupport [ "--with-gssapi" ] 332 363 ++ lib.optionals pythonSupport [ "--with-python" ] 333 364 ++ lib.optionals jitSupport [ "--with-llvm" ]
+3
pkgs/top-level/all-packages.nix
··· 10581 10581 postgresql_15 10582 10582 postgresql_16 10583 10583 postgresql_17 10584 + postgresql_18 10584 10585 ; 10585 10586 10586 10587 inherit (postgresqlJitVersions) ··· 10589 10590 postgresql_15_jit 10590 10591 postgresql_16_jit 10591 10592 postgresql_17_jit 10593 + postgresql_18_jit 10592 10594 ; 10593 10595 postgresql = postgresql_17; 10594 10596 postgresql_jit = postgresql_17_jit; ··· 10598 10600 postgresql15Packages = recurseIntoAttrs postgresql_15.pkgs; 10599 10601 postgresql16Packages = recurseIntoAttrs postgresql_16.pkgs; 10600 10602 postgresql17Packages = recurseIntoAttrs postgresql_17.pkgs; 10603 + postgresql18Packages = recurseIntoAttrs postgresql_18.pkgs; 10601 10604 10602 10605 postgres-websockets = haskellPackages.postgres-websockets.bin; 10603 10606 postgrest = haskellPackages.postgrest.bin;