as per postgresql manual, interactions with psql should be carried out with the postgresql system user and postgresql db user by default. ensure it happens in postStart.
Nixpkgs is a collection of packages for Nix package manager. Nixpkgs also includes NixOS linux distribution source code.