2021-04-07 14:03:52 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
with lib;
|
2021-04-07 14:03:52 -07:00
|
|
|
let
|
|
|
|
primary-ip = "208.81.3.117";
|
2021-09-29 17:55:13 -07:00
|
|
|
git-server-ip = "208.81.3.118";
|
2021-04-07 14:03:52 -07:00
|
|
|
hostname = config.instance.hostname;
|
|
|
|
domain-name = config.fudo.hosts.${hostname}.domain;
|
|
|
|
domain = config.fudo.domains.${domain-name};
|
|
|
|
host-fqdn = "${hostname}.${domain-name}";
|
|
|
|
mail-hostname = "mail.fudo.org";
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
france-secrets = config.fudo.secrets.host-secrets.france;
|
|
|
|
|
|
|
|
acme-private-key = hostname: "/var/lib/acme/${hostname}/key.pem";
|
|
|
|
acme-certificate = hostname: "/var/lib/acme/${hostname}/fullchain.pem";
|
|
|
|
|
2021-04-07 14:03:52 -07:00
|
|
|
in {
|
2021-10-28 09:32:35 -07:00
|
|
|
imports = let
|
|
|
|
is-regular-file = filename: type: type == "regular" || type == "link";
|
|
|
|
regular-files = path:
|
|
|
|
attrNames (filterAttrs is-regular-file (builtins.readDir path));
|
|
|
|
is-nix-file = filename: (builtins.match "^(.+)\.nix$" filename) != null;
|
|
|
|
nix-files = path:
|
|
|
|
map
|
|
|
|
(file: path + "/${file}")
|
|
|
|
(filter is-nix-file (regular-files path));
|
|
|
|
in nix-files ./france;
|
2021-04-07 14:03:52 -07:00
|
|
|
|
|
|
|
config = {
|
|
|
|
fudo = {
|
2021-10-28 09:32:35 -07:00
|
|
|
hosts.france.external-interfaces = [ "extif0" ];
|
2021-04-07 14:03:52 -07:00
|
|
|
|
|
|
|
client.dns = {
|
|
|
|
enable = true;
|
|
|
|
ipv4 = true;
|
|
|
|
ipv6 = true;
|
2021-10-28 09:32:35 -07:00
|
|
|
user = "fudo-client";
|
2021-04-07 14:03:52 -07:00
|
|
|
external-interface = "extif0";
|
|
|
|
};
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
france = {
|
|
|
|
mail = {
|
|
|
|
mail-directory = "/state/mail-server/mail";
|
|
|
|
state-directory = "/state/mail-server/var";
|
|
|
|
ldap-server-urls = [
|
|
|
|
"ldap://france.fudo.org"
|
|
|
|
];
|
2021-04-07 14:03:52 -07:00
|
|
|
};
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
webmail = {
|
|
|
|
# TODO: this is not using the database!
|
|
|
|
mail-server = mail-hostname;
|
|
|
|
database.hostname = "localhost";
|
2021-04-07 14:03:52 -07:00
|
|
|
};
|
2021-10-28 09:32:35 -07:00
|
|
|
|
|
|
|
git = {
|
|
|
|
repository-directory = "/state/gitea/repo";
|
|
|
|
state-directory = "/state/gitea/state";
|
|
|
|
ssh.listen-ip = git-server-ip;
|
2021-04-07 14:03:52 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
minecraft-server = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.minecraft-current;
|
2021-10-28 09:32:35 -07:00
|
|
|
data-dir = "/state/minecraft/selbyland";
|
2021-04-07 14:03:52 -07:00
|
|
|
world-name = "selbyland";
|
|
|
|
motd = "Welcome to the Selby Minecraft server.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
intif0 = {
|
|
|
|
ipv4.addresses = [{
|
|
|
|
address = "192.168.11.1";
|
|
|
|
prefixLength = 24;
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
extif0 = {
|
|
|
|
ipv4.addresses = [
|
|
|
|
{
|
|
|
|
address = primary-ip;
|
|
|
|
prefixLength = 28;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
address = git-server-ip;
|
|
|
|
prefixLength = 32;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisations = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
|
|
|
virtualHosts = {
|
|
|
|
"mail.fudo.org" = {
|
|
|
|
enableACME = true;
|
|
|
|
locations."/".return = "301 https://webmail.fudo.org$request_uri";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|