jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.83k stars 187 forks source link

Add plugin support for postgres extensions #2088

Open Lagoja opened 1 month ago

Lagoja commented 1 month ago

Summary

This PR makes it possible to install Postgres Extensions with Devbox. This didn't work with previous versions of Devbox + the Postgres plugin because:

  1. Postgres was only looking for extensions within a subdirectory of the Postgres package in the Nix Store. Unless we install the extensions using the
  2. The default PostgreSQL output out doesn't include libraries used to install some extensions.

Fortunately, the Nix PostgreSQL package is patched so that you can set the pkglibdir at runtime using the NIX_PGLIBDIR environment variable. If we set this variable to $DEVBOX_PACKAGES_DIR/lib, and if the user installs the lib output, extensions should work as expected.

This PR sets the NIX_PGLIBDIR variable in the plugin, and adds documentation + modifies the example to highlight how to install postgres with the lib output.

How was it tested?

Tested on our Postgres example with the PostGIS extension.