habbah
February 20, 2020, 5:33am
1
Hi, I’m trying to use postgresql, and my original attempt was to do nix-env -i postgresql
, and it installed, but I ran into issues when trying to use it. The logfile was said it was missing /run/postgresql
or something. After searching, I landed on adding a services.postgresql set to /etc/nixos/configuration.nix
That section now looks like this:
services.postgresql = {
enable = true;
package = pkgs.postgresql_11;
dataDir = "/data/postgresql";
}
After applying the changes with nixos-rebuild and rebooting, I get the following errors:
$ psql
psql: FATAL: database "habbah" does not exist
$ psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
Any help is appreciated!
1 Like
SRGOM
February 20, 2020, 6:03am
2
Global NixOS 23.11 manual | Nix & NixOS
Per proj
Hi,
With my limited knowledge, I’m trying to figure out how to configure a PostgreSQL database in my dev environment, created via a shell.nix file. Currently, in shellHook, I edit postgresql.conf with sed right after calling initdb , but there has to be a better solution, especially if many options need to configured.
Tried passing the configuration options directly to pg_ctl but they don’t seem to take effect:
pg_ctl \ …
Edit: looks like I only read the title and the first part of your post. try createdb
efore using psql.
1 Like
habbah
February 20, 2020, 5:07pm
4
createdb
didn’t seem to work/
$ createdb
createdb: database creation failed: ERROR: permission denied to create