Add other services
This commit is contained in:
parent
0bbb49efee
commit
ff8a4d23a9
10 changed files with 377 additions and 7 deletions
39
services/postgresql/default.nix
Normal file
39
services/postgresql/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.vm_postgresql;
|
||||
in
|
||||
{
|
||||
options.services.vm_postgresql = {
|
||||
enable = lib.mkEnableOption "Enable minimal config";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
enableTCPIP = true;
|
||||
settings.port = 5432;
|
||||
ensureDatabases = [ "gitea" "nextcloud" ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "gitea";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "nextcloud";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
#type database user origin-address auth-method
|
||||
# IPv4 local connections:
|
||||
local all all trust
|
||||
host gitea gitea 192.168.122.3/24 trust
|
||||
host nextcloud nextcloud 192.168.122.7/24 trust
|
||||
'';
|
||||
initialScript = pkgs.writeText "init-sql-script" ''
|
||||
alter user gitea with password 'gitea';
|
||||
alter user nextcloud with password 'nextcloud';
|
||||
'';
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 5432 ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue