nix: Install and initialize a Postgres DB For a persistance layer, this change introduces postgresql as dependency. The daemon is started when `nix-shell` is invoked. `pg_ctl stop` is not invoked, and this has to be done by a developer. Data is persisted in a tmp directory, which is added to the ignore file.
Dependencies
- [2]
W3M3C7CCInitial commit This change includes a very small hello world application server written in Rust using Rocket.rs. Managing dependencies is done with Nix as that works well between Linux and Mac for me.
Change contents
- edit in shell.nix at line 14
# Databasepkgs.buildPackages.postgresql - edit in shell.nix at line 20
shellHook = ''export PGDATA=$PWD/tmp/postgres_dataexport PGHOST=$PWD/tmp/postgresexport LOG_PATH=$PWD/tmp/postgres/LOGexport PGDATABASE=postgresexport DATABASE_URL="postgresql:///postgres?host=$PGHOST"if [ ! -d $PGHOST ]; thenmkdir -p $PGHOSTfiif [ ! -d $PGDATA ]; thenecho 'Initializing postgresql database...'initdb $PGDATA --auth=trust >/dev/nullfipg_ctl start -l $LOG_PATH -o "-c listen_addresses= -c unix_socket_directories=$PGHOST"''; - file addition: .ignore[1.0]
/target/tmp