The script is a modified version of the script shown in the PostgreSQL
Upgrading section of the NixOS manual. Our version is for upgrading
PostgreSQL 14 to 15.
Basically do steps 1-3 of the section.
Link to the section:
https://nixos.org/manual/nixos/stable/#module-services-postgres-upgrading