A Nix-based PostgreSQL development environment that provides a user-managed PostgreSQL instance. This project sets up PostgreSQL 17 with a simple management interface, allowing you to run a personal PostgreSQL server for development purposes.
- PostgreSQL 17 with JIT support
- User-managed PostgreSQL instance (runs under your user account)
- Simple management script for starting/stopping the server
- Default configuration optimized for development
- Data stored in a configurable directory
-
Build the package:
nix build .
-
Start PostgreSQL:
./result/bin/manage-postgresql start
-
Connect to PostgreSQL:
psql
This will connect to your default database (named after your username)
-
Stop PostgreSQL when done:
./result/bin/manage-postgresql stop
- Runs on port 5432
- Data directory:
~/.local/share/postgresql
- Default database: your username
- Runs under your user account (no separate postgres user)
- Optimized settings for development:
- max_connections = 100
- shared_buffers = 128MB
- effective_cache_size = 512MB
- maintenance_work_mem = 64MB
- And more...
The manage-postgresql
script provides these commands:
start
: Start the PostgreSQL serverstop
: Stop the PostgreSQL serverrestart
: Restart the PostgreSQL serverstatus
: Check the server status
A development shell is provided with PostgreSQL tools:
nix develop
flake.nix
: Main flake definitionpostgresql/
: PostgreSQL package definitionLICENSE
: MIT License.gitignore
: Excludes Nix build artifacts
This project is licensed under the MIT License - see the LICENSE file for details.