Hi. I’m noob in postgre and nix. I tried installing postgre with the expression “$nix-env -iA nixos.postgresql100”
I found at NixOS Search - Loading..., using option postgresql-10.6. All right.
Following the postgre manual I tried to create a DB with “$ createdb mydb”, but I got:
‘createdb: could not connect to database postgres: could not connect to
server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/tmp/.s.PGSQL.5432”?’
According to the manual this is a problem. How do I install? Me doing it wrong?
Do you run NixOS, or just Nix inside some other Linux distribution?
If you run NixOS, then you need to add
services.postgresql.enable = true; to your
/etc/nixos/configuration.nix, and run
nixos-rebuild switch. This will activate the PostgreSQL service (as opposed to just fetching and installing the PostgreSQL software), so you’ll actually have the PostgreSQL server running.
I’m using NixOS. I’ll try this and come back.
Thank you very much.
You must create a cluster or instance of postgresql by launch the command initdb
example : initdb -D ~/PathOnYourData/DB2
After launch the postgres server by the command
pg_ctl -D ~/PathOnYourData/DB2 -l logfile
You can also modify the parameter before launch in ~/PathOnYourData/DB2/postgresql.conf
After you can create a DB in the postgres server by the command createdb …