Remove PostreSQL database from shell.nix

This commit is contained in:
coolneng 2021-02-12 13:18:04 +01:00
parent beea1ed310
commit 02a5c39319
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 2 additions and 22 deletions

View File

@ -2,30 +2,10 @@
with pkgs; with pkgs;
let mkShell {
sql_file = "psql_creation.sql"; buildInputs = [ python27 python27Packages.virtualenv ];
data_dir = "$(pwd)/.pgdata";
origin = "databases/odyfo.db";
in mkShell {
buildInputs = [ postgresql python27 python27Packages.virtualenv ];
shellHook = '' shellHook = ''
trap "kill 0" EXIT
export PGDATA="${data_dir}"
export PGHOST="${data_dir}"
if [ ! -d ${data_dir} ]; then
initdb --auth-local=trust --no-locale --encoding=UTF8
fi
if ! pg_ctl status; then
pg_ctl start -o "--unix_socket_directories=${data_dir} --listen_addresses='''"
fi
alias psql='psql -d postgres'
alias nuke='rm -rf ${data_dir}'
# Workaround to use pip # Workaround to use pip
SOURCE_DATE_EPOCH=$(date +%s) SOURCE_DATE_EPOCH=$(date +%s)
virtualenv .venv virtualenv .venv