bootstrap/specs/postgres/template
Joshua Potter 22210e7722 Update the `PGDATA` environment variable. 2023-12-01 10:55:04 -07:00
..
.envrc Add postgres spec. 2023-11-26 15:44:53 -07:00
.gitignore Initialize database clusters on bootstrap. 2023-11-28 10:29:42 -07:00
README.md Normalize bash prompts and flake descriptions. 2023-12-01 10:12:16 -07:00
default.nix Add postgres spec. 2023-11-26 15:44:53 -07:00
flake.lock Add `flake.lock` to postgres spec. 2023-11-27 04:59:42 -07:00
flake.nix Update the `PGDATA` environment variable. 2023-12-01 10:55:04 -07:00

README.md

Postgres Flake Template

This is a template for constructing a working environment for local Postgres (version 15.5) usage. direnv can be used to a launch a dev shell upon entering this directory (refer to .envrc). Otherwise run via:

$ nix develop

Quickstart

An empty Postgres cluster is initialized at /db. To start the database, run the following:

$ pg_ctl -D db -l db/logfile -o --unix_socket_directories=@postgres start

In the above command, @postgres refers to an abstract socket name. Rename to whatever is appropriate for your use case. To then connect to this database instance, run:

$ psql -h @postgres

To later shut the database down, run:

$ pg_ctl -D db stop