supabase / supavisor

A cloud-native, multi-tenant Postgres connection pooler.
https://supabase.github.io/supavisor/
Apache License 2.0
1.7k stars 56 forks source link

chore: add Nix Flake to project #400

Closed hauleth closed 1 month ago

hauleth commented 1 month ago

What kind of change does this PR introduce?

Add Nix Flake with Devenv shell for development.

Currently it defines only development environment for Supavisor. In the future the plan is to add package definition as well as NixOS module to the Flake. This will simplify deployment on NixOS platforms as well as should help with spawning virtual machines with Supavisor running on them.

To use this shell you need to install Nix or Lix and then you can use:

nix develop --impure

To start new Bash shell with all dependencies installed.

To run PostgreSQL you can use:

nix run .#up --impure

Which will create DB and run initialisation script. It will run it natively, not within Docker or other containerisation technology.

I am also working on defining QEMU VMs inside flake.nix which will allow seamlessly spawning test VMs as needed during development.

Additional context

Some reading materials about Nix and Flakes.