config-perso/machines/kat-mail-test/default.nix

150 lines
2.9 KiB
Nix
Raw Normal View History

2024-06-19 08:34:47 +02:00
{
config,
lib,
pkgs,
2024-10-14 17:04:43 +02:00
nodes,
2024-06-21 13:46:57 +02:00
sources,
ssh-keys,
2024-06-19 08:34:47 +02:00
...
}:
2024-06-21 13:46:57 +02:00
let
2024-07-18 14:47:43 +02:00
host = "catvayor.sh";
2024-06-21 13:46:57 +02:00
in
2024-06-19 08:34:47 +02:00
{
deployment = {
targetHost = "mail-test.kat";
tags = [ "kat-vms" ];
};
2024-06-19 08:34:47 +02:00
imports = [
2024-06-21 13:46:57 +02:00
"${sources.nixos-mailserver}"
2024-06-19 08:34:47 +02:00
./hardware-configuration.nix
./disks.nix
2024-06-21 13:46:57 +02:00
./modo.nix
2024-06-19 08:34:47 +02:00
];
users.users.root.openssh.authorizedKeys.keys = ssh-keys.sylvain;
kat = {
fqdn = "betamail.katvayor.net";
wireguardPubKey = "Znj451+hGJcPV1zFgpRMA8hg8edmUInA5zBtYBUuL3k=";
proxies = {
ip = "192.168.122.3";
aliases = [ "catvayor.sh" ];
open-tcp = [
{
internal = 22;
external = 22002;
}
25
465
993
];
};
2024-10-20 18:52:05 +02:00
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelParams = [ "console=ttyS0" ];
2024-10-03 17:42:38 +02:00
};
2024-06-19 08:34:47 +02:00
2024-10-14 17:04:43 +02:00
systemd.network = {
networks = {
"10-enp1s0" = {
name = "enp1s0";
address = [
"192.168.122.3/24"
"fe80::3/64"
];
routes = [
{
2024-10-20 15:11:00 +02:00
Destination = "10.42.0.2/32";
Gateway = "192.168.122.1";
2024-10-14 17:04:43 +02:00
}
];
dns = [ "192.168.122.1" ];
};
"50-wg0" = {
name = "wg0";
address = [ "10.42.2.1/16" ];
routes = [
{
2024-10-20 15:11:00 +02:00
Gateway = "10.42.0.2";
2024-10-14 17:04:43 +02:00
}
];
};
2024-06-19 08:34:47 +02:00
};
2024-10-14 17:04:43 +02:00
netdevs = {
"50-wg0" = {
netdevConfig = {
Name = "wg0";
Kind = "wireguard";
};
wireguardConfig = {
PrivateKeyFile = "/wg/private.key";
};
wireguardPeers = [
{
Endpoint = "10.42.0.2:1194";
AllowedIPs = [
"0.0.0.0/0"
];
PersistentKeepalive = 20;
PublicKey = nodes.kat-watcher.config.kat.wireguardPubKey;
}
];
};
2024-06-19 08:34:47 +02:00
};
};
networking = {
useDHCP = false;
firewall.enable = false;
};
2024-06-19 08:34:47 +02:00
2024-06-21 13:46:57 +02:00
security.acme = {
acceptTerms = true;
defaults.email = "root@katvayor.net";
};
services = {
openssh.enable = true;
qemuGuest.enable = true;
nginx = {
enable = true;
virtualHosts."catvayor.sh".enableACME = true;
virtualHosts."betamail.katvayor.net" = {
enableACME = true;
addSSL = true;
locations."/" = {
recommendedProxySettings = true;
proxyPass = "http://localhost:8000/";
};
2024-07-09 17:55:50 +02:00
};
2024-06-21 13:46:57 +02:00
};
};
mailserver = {
enable = true;
2024-07-18 14:47:43 +02:00
fqdn = "betamail.katvayor.net";
2024-06-21 13:46:57 +02:00
domains = [ host ];
loginAccounts = {
2024-06-23 15:57:17 +02:00
"root@${host}" = {
2024-06-25 18:31:43 +02:00
catchAll = [ host ];
2024-10-14 17:04:43 +02:00
aliases = builtins.genList (id: "user${toString id}@${host}") 10 ++ [
"moderators@${host}"
"daemon@${host}"
];
2024-06-21 13:46:57 +02:00
hashedPassword = "$2b$05$FoCVDECXYG0KXPigPuIZtuNFiviwSg8RuXx0FbnzC7ZRp.Mz8VWOe";
};
};
certificateScheme = "acme";
};
2024-06-19 08:34:47 +02:00
system.stateVersion = "23.11";
}