I want to run postgresql within a nix-shell. I followed the instructions on this page: https://mgdm.net/weblog/postgresql-in-a-nix-shell/
PostgreSQL installs properly in the shell (it's not installed on the main system at all), and I can start the server:
[nix-shell:~/Prog/Rust/ibis]$ pg_ctl -D .tmp/mydb -l logfile -o "--unix_socket_directories='$PWD'" start waiting for server to start.... done server started But then if I try to create a database it gives me an error about connection on server socket. I tried two ways and they give the same error:
[nix-shell:~/Prog/Rust/ibis]$ createdb mydb createdb: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? and
[nix-shell:~/Prog/Rust/ibis]$ psql -c "CREATE USER ibis WITH PASSWORD 'censored' SUPERUSER;" -U postgres psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? I have created a /run/postgresql/ folder within the project folder. I used chmod to give full permissions to all.
What am I not understanding here? I can start and stop the server, and the folder exists within the project folders.
postgresql.confper Connection settings isportset to something other then5432and what islisten_addressesset to. Add answers as text update to question text.