From 188890b1e937751e54feae83741d393d34c97cd3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 2 Dec 2024 12:23:34 +0100 Subject: [PATCH] services: postgres: upgrade to 16 --- services/postgresql.nix | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/services/postgresql.nix b/services/postgresql.nix index ec4b82a..4446cc8 100644 --- a/services/postgresql.nix +++ b/services/postgresql.nix @@ -6,35 +6,6 @@ }: { # set postgresql version so we don't get any bad surprise config.services.postgresql = { - package = pkgs.postgresql_15; + package = pkgs.postgresql_16; }; - - config.environment.systemPackages = [ - (let - # XXX specify the postgresql package you'd like to upgrade to. - # Do not forget to list the extensions you need. - newPostgres = pkgs.postgresql_16; - cfg = config.services.postgresql; - in pkgs.writeScriptBin "upgrade-pg-cluster" '' - set -eux - # XXX it's perhaps advisable to stop all services that depend on postgresql - systemctl stop postgresql - - export NEWDATA="/var/lib/postgresql/${newPostgres.psqlSchema}" - - export NEWBIN="${newPostgres}/bin" - - export OLDDATA="${cfg.dataDir}" - export OLDBIN="${cfg.package}/bin" - - install -d -m 0700 -o postgres -g postgres "$NEWDATA" - cd "$NEWDATA" - sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" ${lib.escapeShellArgs cfg.initdbArgs} - - sudo -u postgres $NEWBIN/pg_upgrade \ - --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \ - --old-bindir $OLDBIN --new-bindir $NEWBIN \ - "$@" - '') - ]; }