How do I imperatively install postgresql with additional packages?

I’ve been installing PostgreSQL using nix-env -iA nixpkgs-latest.postgresql_12. This works well but does not install user contributed modules.

I see the derivation’s definition has a postgresqlWithPackages:

How do I consume this using nix-env -i or an equivalent? I’d be happy to use a nix expression as well but don’t understand them very well so often resort to what works.

1 Like

It turns out the extension I needed is already included in the compiled version provided by nix. I just needed to execute the following on the given database:

CREATE EXTENSION citext SCHEMA public;