nix-config/hosts/hedgedoc/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.8 KiB
Nix
Raw Normal View History

2022-12-05 01:54:49 +01:00
{ config, pkgs, zentralwerk, ... }:
2022-06-21 22:00:17 +02:00
{
c3d2.deployment.server = "server10";
2022-06-21 22:00:17 +02:00
microvm.mem = 1024;
boot.kernel.sysctl = {
# table overflow causing packets from nginx to hedgedoc to drop
# nf_conntrack: nf_conntrack: table full, dropping packet
2022-11-03 20:13:00 +01:00
"net.netfilter.nf_conntrack_max" = "65536";
};
2022-06-21 22:00:17 +02:00
networking = {
hostName = "hedgedoc";
2022-12-05 01:54:49 +01:00
hosts = with zentralwerk.lib.config.site.net.serv; {
${hosts6.up4.auth} = [ "auth.c3d2.de" ];
${hosts4.auth} = [ "auth.c3d2.de" ];
};
2022-06-21 22:00:17 +02:00
firewall.allowedTCPPorts = [ 80 443 ];
};
services = {
hedgedoc = {
enable = true;
settings = {
2022-06-21 22:00:17 +02:00
allowAnonymousEdits = true;
allowFreeURL = true;
allowOrigin = [ "hedgedoc.c3d2.de" ];
2022-06-21 22:00:17 +02:00
csp = {
enable = true;
addDefaults = true;
upgradeInsecureRequest = "auto";
};
db = {
dialect = "postgres";
2022-06-22 00:52:07 +02:00
host = "/run/postgresql/";
2022-06-21 22:00:17 +02:00
};
defaultPermission = "freely";
domain = "hedgedoc.c3d2.de";
ldap = {
url = "ldaps://auth.c3d2.de";
bindDn = "uid=search,ou=users,dc=c3d2,dc=de";
bindCredentials = "$bindCredentials";
searchBase = "ou=users,dc=c3d2,dc=de";
searchFilter = "(&(objectclass=person)(uid={{username}}))";
tlsca = "/etc/ssl/certs/ca-certificates.crt";
useridField = "uid";
};
2022-06-22 00:52:07 +02:00
protocolUseSSL = true;
2022-06-22 00:42:06 +02:00
sessionSecret = "$sessionSecret";
2022-06-21 22:00:17 +02:00
};
2022-06-22 01:24:40 +02:00
environmentFile = config.sops.secrets."hedgedoc".path;
2022-06-21 22:00:17 +02:00
};
2022-06-21 22:00:17 +02:00
nginx = {
enable = true;
enableReload = true;
virtualHosts = {
"codimd.c3d2.de" = {
forceSSL = true;
enableACME = true;
locations."/".return = "301 https://hedgedoc.c3d2.de$request_uri";
};
2022-09-01 23:56:14 +02:00
"hackmd.c3d2.de" = {
forceSSL = true;
enableACME = true;
locations."/".return = "301 https://hedgedoc.c3d2.de$request_uri";
};
"hedgedoc.c3d2.de" = {
default = true;
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:${toString config.services.hedgedoc.configuration.port}";
2022-06-21 22:00:17 +02:00
};
};
};
2022-06-21 22:00:17 +02:00
postgresql = {
enable = true;
ensureDatabases = [
"hedgedoc"
];
ensureUsers = [
{
name = "hedgedoc";
ensurePermissions = {
"DATABASE \"hedgedoc\"" = "ALL PRIVILEGES";
};
}
];
package = pkgs.postgresql_14;
};
};
2022-06-22 00:42:06 +02:00
sops = {
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
2022-07-31 18:13:03 +02:00
defaultSopsFile = ./secrets.yaml;
2022-06-22 00:42:06 +02:00
secrets = {
"hedgedoc".owner = config.systemd.services.hedgedoc.serviceConfig.User;
};
};
2022-10-31 22:14:16 +01:00
system.stateVersion = "22.11";
2022-06-21 22:00:17 +02:00
}