haccfiles/parsons/hedgedoc-i4f.nix

75 lines
2 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, evalConfig, ... }:
2021-08-07 17:38:40 +00:00
{
containers.pad-i4f = {
privateNetwork = true;
hostAddress = "192.168.100.1";
localAddress = "192.168.100.6";
autoStart = true;
2024-02-22 20:15:41 +00:00
ephemeral = true;
2021-08-07 17:38:40 +00:00
bindMounts = {
"/persist" = {
hostPath = "/persist/containers/pad-i4f";
isReadOnly = false;
};
};
path = evalConfig ({ config, lib, ... }: {
2021-08-07 17:38:40 +00:00
services.hedgedoc = {
enable = true;
settings = {
2021-08-07 17:38:40 +00:00
allowAnonymous = true;
allowFreeURL = true;
allowGravatar = false;
allowOrigin = [ "localhost" "pad.infra4future.de" "fff-muc.de" ];
db = {
host = "/run/postgresql";
dialect = "postgres";
database = "hedgedoc";
};
2021-08-07 17:38:40 +00:00
defaultPermission = "freely";
domain = "pad.infra4future.de";
host = "0.0.0.0";
protocolUseSSL = true;
hsts.preload = false;
email = false;
};
};
systemd.services.hedgedoc.environment = {
"CMD_LOGLEVEL" = "warn";
};
2021-08-07 17:38:40 +00:00
services.postgresql = {
enable = true;
package = pkgs.postgresql_15;
2021-08-07 17:38:40 +00:00
authentication = ''
local all all trust
host hedgedoc hedgedoc 127.0.0.1/32 trust
'';
ensureDatabases = [ "hedgedoc" ];
ensureUsers = [{
name = "hedgedoc";
ensureDBOwnership = true;
2021-08-07 17:38:40 +00:00
}];
};
services.postgresqlBackup = {
enable = true;
databases = [ "hedgedoc" ];
startAt = "*-*-* 23:45:00";
2021-08-07 18:27:04 +00:00
location = "/persist/backups/postgres";
2021-08-07 17:38:40 +00:00
};
hacc.bindToPersist = [ "/var/lib/hedgedoc" ];
});
2021-08-07 17:38:40 +00:00
};
services.nginx.virtualHosts."pad.infra4future.de" = {
forceSSL = true;
enableACME = true;
locations."/" = {
2021-08-07 18:27:04 +00:00
proxyPass = "http://${config.containers.pad-i4f.localAddress}:3000";
2021-08-07 17:38:40 +00:00
extraConfig = ''
add_header Access-Control-Allow-Origin "*";
proxy_buffering off;
'';
};
};
}