mirror of
https://github.com/srid/nixos-config.git
synced 2025-12-26 23:14:57 +08:00
add postgres
This commit is contained in:
parent
442e237a53
commit
41dbddc983
2 changed files with 23 additions and 0 deletions
22
features/postgres.nix
Normal file
22
features/postgres.nix
Normal 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;
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
./features/ema/emanote.nix
|
||||
./features/lxd.nix
|
||||
./features/docker.nix
|
||||
./features/postgres.nix
|
||||
];
|
||||
thin = mkComputer
|
||||
./hosts/thin.nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue