Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: improve dev workflow #21

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

steve-chavez
Copy link
Member

Solves #5.

This is done by avoiding building the postgres extension inside the nix derivation. Instead we build it with make on the current directory and install it on postgres using the upcoming postgres extension_control_path GUC.

This is taken from the patch on
https://www.postgresql.org/message-id/flat/E7C7BFFB-8857-48D4-A71F-88B359FADCFD%40justatheory.com and backpatched to postgres 12, 13, 14, 15 and 16,

Thanks to this, it's now possible to do watch commands:

nxpg-watch nxpg-16 nxpg-build (rebuilds when changing sources)

nxpg-watch nxpg-13 nxpg-tmp nxpg-test (runs tests when changing sources)

Future improvements:

  • Makes possible to enable code coverage, since the .gcno files will live outside the nix store.

  • It's wasteful to rebuild the patched pgs everytime, later on this nxpg could live in another repo and benefit from Nix caching.

Additionally:

  • removes clean_generated in favor of builtin EXTRA_CLEAN

  • Don't hardcode sources in Makefile

  • Update github action

Solves PostgREST#5.

This is done by avoiding building the postgres extension inside the nix
derivation. Instead we build it with `make` on the current directory and
install it on postgres using the upcoming postgres
`extension_control_path` GUC.

This is taken from the patch on
https://www.postgresql.org/message-id/flat/E7C7BFFB-8857-48D4-A71F-88B359FADCFD%40justatheory.com
and backpatched to postgres 12, 13, 14, 15 and 16,

Thanks to this, it's now possible to do watch commands:

```
nxpg-watch nxpg-16 nxpg-build (rebuilds when changing sources)

nxpg-watch nxpg-13 nxpg-tmp nxpg-test (runs tests when changing sources)
```

Future improvements:

* Makes possible to enable code coverage, since the `.gcno` files will
  live outside the nix store.

* It's wasteful to rebuild the patched pgs everytime, later on this
  `nxpg` could live in another repo and benefit from Nix caching.

Additionally:

* removes clean_generated in favor of builtin EXTRA_CLEAN

* Don't hardcode sources in Makefile

* Update github action
@steve-chavez steve-chavez marked this pull request as ready for review February 4, 2025 01:49
@steve-chavez steve-chavez merged commit 51be9a8 into PostgREST:master Feb 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant