96 lines
2.7 KiB
Nix
96 lines
2.7 KiB
Nix
{ config, lib, pkgs, modules, evalConfig, sources, ... }:
|
|
|
|
{
|
|
containers.pad-i4f = {
|
|
privateNetwork = true;
|
|
hostAddress = "192.168.100.1";
|
|
localAddress = "192.168.100.6";
|
|
autoStart = true;
|
|
bindMounts = {
|
|
"/persist" = {
|
|
hostPath = "/persist/containers/pad-i4f";
|
|
isReadOnly = false;
|
|
};
|
|
};
|
|
path = (evalConfig {hosts = {}; groups = {};} ({ config, lib, pkgs, profiles, modules, sources, ... }: {
|
|
boot.isContainer = true;
|
|
networking.useDHCP = false;
|
|
users.users.root.hashedPassword = "";
|
|
system.stateVersion = "21.05";
|
|
|
|
|
|
imports = [ sources.nix-hexchen.nixosModules.profiles.nopersist ];
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
networking.firewall.enable = false;
|
|
networking.defaultGateway = {
|
|
address = "192.168.100.1";
|
|
interface = "eth0";
|
|
};
|
|
services.coredns = {
|
|
enable = true;
|
|
config = ''
|
|
.:53 {
|
|
forward . 1.1.1.1
|
|
}
|
|
'';
|
|
};
|
|
services.hedgedoc = {
|
|
enable = true;
|
|
settings = {
|
|
allowAnonymous = true;
|
|
allowFreeURL = true;
|
|
allowGravatar = false;
|
|
allowOrigin = [ "localhost" "pad.infra4future.de" "fff-muc.de" ];
|
|
db = {
|
|
host = "/run/postgresql";
|
|
dialect = "postgres";
|
|
database = "hedgedoc";
|
|
};
|
|
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";
|
|
};
|
|
services.postgresql = {
|
|
enable = true;
|
|
package = pkgs.postgresql_11;
|
|
authentication = ''
|
|
local all all trust
|
|
host hedgedoc hedgedoc 127.0.0.1/32 trust
|
|
'';
|
|
ensureDatabases = [ "hedgedoc" ];
|
|
ensureUsers = [{
|
|
name = "hedgedoc";
|
|
ensurePermissions = {
|
|
"DATABASE hedgedoc" = "ALL PRIVILEGES";
|
|
};
|
|
}];
|
|
};
|
|
services.postgresqlBackup = {
|
|
enable = true;
|
|
databases = [ "hedgedoc" ];
|
|
startAt = "*-*-* 23:45:00";
|
|
location = "/persist/backups/postgres";
|
|
};
|
|
})).config.system.build.toplevel;
|
|
};
|
|
|
|
services.nginx.virtualHosts."pad.infra4future.de" = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
proxyPass = "http://${config.containers.pad-i4f.localAddress}:3000";
|
|
extraConfig = ''
|
|
add_header Access-Control-Allow-Origin "*";
|
|
proxy_buffering off;
|
|
'';
|
|
};
|
|
};
|
|
}
|