add postgres

This commit is contained in:
Sridhar Ratnakumar 2021-11-01 15:47:30 -04:00
parent 442e237a53
commit 41dbddc983
2 changed files with 23 additions and 0 deletions

22
features/postgres.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
# PostgreSQL itself
services.postgresql = {
enable = true;
package = pkgs.postgresql_12; # HACK: for work
# enableTCPIP = false;
# https://nixos.wiki/wiki/PostgreSQL
authentication = pkgs.lib.mkOverride 10
''
# Unix domain socket
local all all trust
# TCP/IP connections from loopback only
host all all ::1/128 trust
'';
initialScript = pkgs.writeText "backend-initScript" ''
CREATE ROLE nixcloud WITH LOGIN PASSWORD 'nixcloud' CREATEDB;
CREATE DATABASE nixcloud;
GRANT ALL PRIVILEGES ON DATABASE nixcloud TO nixcloud;
'';
};
}

View file

@ -69,6 +69,7 @@
./features/ema/emanote.nix
./features/lxd.nix
./features/docker.nix
./features/postgres.nix
];
thin = mkComputer
./hosts/thin.nix