diff --git a/modules/dgn-console.nix b/modules/dgn-console.nix index 20f7eca..f3c8fea 100644 --- a/modules/dgn-console.nix +++ b/modules/dgn-console.nix @@ -76,30 +76,32 @@ in mtr tcpdump ]) - ++ lib.optional - (config.services.postgresql.enable && config.services.postgresql.package != cfg.pg-upgrade-to) - ( - pkgs.writeScriptBin "upgrade-pg-cluster" '' - set -eux - # XXX it's perhaps advisable to stop all services that depend on postgresql - systemctl stop postgresql + ++ [ config.boot.kernelPackages.perf ] + ++ + lib.optional + (config.services.postgresql.enable && config.services.postgresql.package != cfg.pg-upgrade-to) + ( + 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/${cfg.pg-upgrade-to.psqlSchema}" + export NEWDATA="/var/lib/postgresql/${cfg.pg-upgrade-to.psqlSchema}" - export NEWBIN="${cfg.pg-upgrade-to}/bin" + export NEWBIN="${cfg.pg-upgrade-to}/bin" - export OLDDATA="${config.services.postgresql.dataDir}" - export OLDBIN="${config.services.postgresql.package}/bin" + export OLDDATA="${config.services.postgresql.dataDir}" + export OLDBIN="${config.services.postgresql.package}/bin" - install -d -m 0700 -o postgres -g postgres "$NEWDATA" - cd "$NEWDATA" - sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" + install -d -m 0700 -o postgres -g postgres "$NEWDATA" + cd "$NEWDATA" + sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" - sudo -u postgres $NEWBIN/pg_upgrade \ - --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \ - --old-bindir $OLDBIN --new-bindir $NEWBIN \ - "$@" - '' - ); + sudo -u postgres $NEWBIN/pg_upgrade \ + --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \ + --old-bindir $OLDBIN --new-bindir $NEWBIN \ + "$@" + '' + ); }; }