diff --git a/nixos/modules/services/databases/postgresql.md b/nixos/modules/services/databases/postgresql.md index 58a76e4846b2..fbff43290529 100644 --- a/nixos/modules/services/databases/postgresql.md +++ b/nixos/modules/services/databases/postgresql.md @@ -251,8 +251,10 @@ PostgreSQL's versioning policy is described [here](https://www.postgresql.org/su 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). -Thus: -- In September/October the new major version will be released and added to nixos-unstable. +Thus, our release workflow is as follows: + +- 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. +- In September/October the new major version will be released, replacing the beta package in nixos-unstable. - In November the last minor version for the oldest major will be released. - Both the current stable .05 release and nixos-unstable should be updated to the latest minor that will usually be released in November. - 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. diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 29cef9b40e18..aa844ada5e3e 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -43,16 +43,6 @@ let cfg = config.services.postgresql; - # ensure that - # services.postgresql = { - # enableJIT = true; - # package = pkgs.postgresql_; - # }; - # works. - basePackage = if cfg.enableJIT then cfg.package.withJIT else cfg.package.withoutJIT; - - postgresql = if cfg.extensions == [ ] then basePackage else basePackage.withPackages cfg.extensions; - toStr = value: if true == value then @@ -72,13 +62,13 @@ let ); configFileCheck = pkgs.runCommand "postgresql-configfile-check" { } '' - ${cfg.package}/bin/postgres -D${configFile} -C config_file >/dev/null + ${cfg.finalPackage}/bin/postgres -D${configFile} -C config_file >/dev/null touch $out ''; groupAccessAvailable = versionAtLeast cfg.finalPackage.version "11.0"; - extensionNames = map getName postgresql.installedExtensions; + extensionNames = map getName cfg.finalPackage.installedExtensions; extensionInstalled = extension: elem extension extensionNames; in @@ -143,7 +133,18 @@ in finalPackage = mkOption { type = types.package; readOnly = true; - default = postgresql; + default = + let + # ensure that + # services.postgresql = { + # enableJIT = true; + # package = pkgs.postgresql_; + # }; + # works. + withJit = if cfg.enableJIT then cfg.package.withJIT else cfg.package.withoutJIT; + withJitAndPackages = if cfg.extensions == [ ] then withJit else withJit.withPackages cfg.extensions; + in + withJitAndPackages; defaultText = "with config.services.postgresql; package.withPackages extensions"; description = '' The postgresql package that will effectively be used in the system. @@ -636,6 +637,20 @@ in config = mkIf cfg.enable { + warnings = ( + let + unstableState = + if lib.hasInfix "beta" cfg.package.version then + "in beta" + else if lib.hasInfix "rc" cfg.package.version then + "a release candidate" + else + null; + in + lib.optional (unstableState != null) + "PostgreSQL ${lib.versions.major cfg.package.version} is currently ${unstableState}, and is not advised for use in production environments." + ); + assertions = map ( { name, ensureDBOwnership, ... }: { diff --git a/pkgs/servers/sql/postgresql/18.nix b/pkgs/servers/sql/postgresql/18.nix new file mode 100644 index 000000000000..89d408e5a720 --- /dev/null +++ b/pkgs/servers/sql/postgresql/18.nix @@ -0,0 +1,11 @@ +import ./generic.nix { + version = "18beta1"; + rev = "refs/tags/REL_18_BETA1"; + hash = "sha256-P86bVYfPzkwK/rcvUInYZew/pKejk58/IcnDGx/BWno="; + muslPatches = { + dont-use-locale-a = { + url = "https://git.alpinelinux.org/aports/plain/main/postgresql17/dont-use-locale-a-on-musl.patch?id=d69ead2c87230118ae7f72cef7d761e761e1f37e"; + hash = "sha256-6zjz3OpMx4qTETdezwZxSJPPdOvhCNu9nXvAaU9SwH8="; + }; + }; +} diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 348620c54360..f9ceda8e500a 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -14,6 +14,7 @@ let postgresql_15 = ./15.nix; postgresql_16 = ./16.nix; postgresql_17 = ./17.nix; + postgresql_18 = ./18.nix; }; mkAttributes = diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index b88bc67e6c77..105b31c63863 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -58,6 +58,16 @@ let # bonjour bonjourSupport ? false, + # Curl + curlSupport ? + lib.versionAtLeast version "18" + && lib.meta.availableOn stdenv.hostPlatform curl + # Building statically fails with: + # configure: error: library 'curl' does not provide curl_multi_init + # https://www.postgresql.org/message-id/487dacec-6d8d-46c0-a36f-d5b8c81a56f1%40technowledgy.de + && !stdenv.hostPlatform.isStatic, + curl, + # GSSAPI gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, libkrb5, @@ -88,6 +98,17 @@ let nlsSupport ? false, gettext, + # NUMA + numaSupport ? + lib.versionAtLeast version "18" + && lib.meta.availableOn stdenv.hostPlatform numactl + # NUMA can fail in 18beta1 on some hardware with: + # ERROR: invalid NUMA node id outside of allowed range [0, 0]: 1 + # https://github.com/NixOS/nixpkgs/pull/411958#issuecomment-3031680123 + # https://www.postgresql.org/message-id/flat/E1u1tr8-003BbN-2E%40gemulon.postgresql.org + && version != "18beta1", + numactl, + # PAM pamSupport ? lib.meta.availableOn stdenv.hostPlatform linux-pam @@ -135,6 +156,10 @@ let # Systemd systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs, systemdLibs, + + # Uring + uringSupport ? lib.versionAtLeast version "18" && lib.meta.availableOn stdenv.hostPlatform liburing, + liburing, }@args: let atLeast = lib.versionAtLeast version; @@ -256,6 +281,9 @@ let ++ lib.optionals lz4Enabled [ lz4 ] ++ lib.optionals zstdEnabled [ zstd ] ++ lib.optionals systemdSupport [ systemdLibs ] + ++ lib.optionals uringSupport [ liburing ] + ++ lib.optionals curlSupport [ curl ] + ++ lib.optionals numaSupport [ numactl ] ++ lib.optionals gssSupport [ libkrb5 ] ++ lib.optionals pamSupport [ linux-pam ] ++ lib.optionals perlSupport [ perl ] @@ -328,6 +356,9 @@ let ++ lib.optionals (withWalBlocksize != null) [ "--with-wal-blocksize=${toString withWalBlocksize}" ] ++ lib.optionals lz4Enabled [ "--with-lz4" ] ++ lib.optionals zstdEnabled [ "--with-zstd" ] + ++ lib.optionals uringSupport [ "--with-liburing" ] + ++ lib.optionals curlSupport [ "--with-libcurl" ] + ++ lib.optionals numaSupport [ "--with-libnuma" ] ++ lib.optionals gssSupport [ "--with-gssapi" ] ++ lib.optionals pythonSupport [ "--with-python" ] ++ lib.optionals jitSupport [ "--with-llvm" ] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1162db0bd8fe..af23783e8e85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10581,6 +10581,7 @@ with pkgs; postgresql_15 postgresql_16 postgresql_17 + postgresql_18 ; inherit (postgresqlJitVersions) @@ -10589,6 +10590,7 @@ with pkgs; postgresql_15_jit postgresql_16_jit postgresql_17_jit + postgresql_18_jit ; postgresql = postgresql_17; postgresql_jit = postgresql_17_jit; @@ -10598,6 +10600,7 @@ with pkgs; postgresql15Packages = recurseIntoAttrs postgresql_15.pkgs; postgresql16Packages = recurseIntoAttrs postgresql_16.pkgs; postgresql17Packages = recurseIntoAttrs postgresql_17.pkgs; + postgresql18Packages = recurseIntoAttrs postgresql_18.pkgs; postgres-websockets = haskellPackages.postgres-websockets.bin; postgrest = haskellPackages.postgrest.bin;