Document postgres with extensions
Add this to https://community.flake.parts/services-flake/postgresql#guide
# In process-compose.<projectName>
{
services.postgres.”pg1” = {
extensions = (extensions: with extensions; [ timescaledb ]);
};
}
Originally posted by @shivaraj-bh in https://github.com/juspay/services-flake/discussions/491#discussioncomment-12590616
In general, yes! However...
TimescaleDB specifically has a non-free licence (although there is an Apache-licenced version in nixkpgs which has fewer features). Plus it seems there is no way to activate the extension within the initialDatabases specified in the flake. I tried initialScript.before/initialScript.after and both ways it creates the extension in the postgres database (almost certainly not where you want most extentions!), not the database specified in initialDatabases. The only way I found to activate the extension within the target database was to create a .sql file with CREATE EXTENSION IF NOT EXISTS timescaledb and add it to the schemas list.
So yes, would be great to expand the Postgres docs to include extensions but, imho, the docs should show an end-to-end working example. The proposed snippet only gets you 1/3 of the way.
you will also need to explicitly add the setting option on top of what @peedrr stated above
settings.shared_preload_libraries = "timescaledb";