Though this might not directly related to nix. I follow the doc[1] here trying to create an isolated environment with postgresql installed. However, when I execute the command createdb mydb
. nix-shell throws
createdb: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?
My shell.nix content:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = [
pkgs.buildPackages.scala_2_13
pkgs.buildPackages.postgresql_9_6
pkgs.buildPackages.vim
];
}
To start entering nix shell the command being ran is nix-shell --pure shell.nix
. Searching the forum I don’t find the related solution. Any suggestions on how to fix or debug this issue?
I know I need to check if the server if up running or not. But executing pg_ctl -D .tmp/mydb -l logfile -o "--unix_socket_directories='$PWD'" start
shows
pg_ctl: another server might be running; trying to start server anyway
server starting
And there are no ps, which utility. Maybe someone can tell me which base packages (Searching with nix base util keywords doesn’t find the solution either) I should install first? Thanks