config-perso/machines/kat-watcher/default.nix

117 lines
2.5 KiB
Nix
Raw Normal View History

2024-06-18 09:47:57 +02:00
{
config,
lib,
pkgs,
nodes,
2024-06-18 09:47:57 +02:00
...
}:
{
imports = [
./hardware-configuration.nix
./disks.nix
];
2024-10-03 17:42:38 +02:00
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
2024-06-18 09:47:57 +02:00
};
2024-10-14 17:04:43 +02:00
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
2024-10-03 17:42:38 +02:00
kat.wireguardPubKey = "BgLBrWG7DRj2Gwoyj+vHZTjiB3gPEnwVcDFEQH/BYgg=";
2024-06-18 09:47:57 +02:00
networking = {
useDHCP = false;
2024-10-03 17:42:38 +02:00
firewall.allowedUDPPorts = [ 1194 ];
2024-10-14 17:04:43 +02:00
nftables = {
enable = true;
tables.nat = {
family = "ip";
content = ''
chain postrouting {
type nat hook postrouting priority 100;
ip saddr 10.42.0.0/16 masquerade
}
'';
};
};
2024-06-18 09:47:57 +02:00
};
systemd.network = {
enable = true;
networks = {
"10-ens3" = {
name = "ens3";
address = [
"51.83.69.54/32"
"2001:41d0:305:2100::5c52/56"
];
routes = [
{ Destination = "51.83.68.1/32"; }
{
Destination = "213.186.33.99/32";
Gateway = "51.83.68.1";
}
{ Gateway = "51.83.68.1"; }
{ Gateway = "2001:41d0:305:2100::1"; }
];
dns = [ "213.186.33.99" ];
};
"50-wg0" = {
name = "wg0";
2024-10-14 17:04:43 +02:00
address = [ "10.42.0.2/16" ];
};
};
netdevs = {
"50-wg0" = {
netdevConfig = {
Name = "wg0";
Kind = "wireguard";
};
wireguardConfig = {
ListenPort = 1194;
PrivateKeyFile = "/etc/wg/private.key";
};
wireguardPeers = [
{
2024-10-03 17:42:38 +02:00
AllowedIPs = [
"10.42.0.1/32"
];
PublicKey = nodes.kat-manah.config.kat.wireguardPubKey;
}
2024-10-13 12:55:30 +02:00
{
AllowedIPs = [
"10.42.1.1/32"
];
PublicKey = nodes.kat-probook.config.kat.wireguardPubKey;
}
2024-10-14 17:04:43 +02:00
{
AllowedIPs = [
"10.42.2.1/32"
];
PublicKey = nodes.kat-mail-test.config.kat.wireguardPubKey;
}
];
};
2024-06-18 09:47:57 +02:00
};
};
security.acme = {
acceptTerms = true;
defaults.email = "root@katvayor.net";
};
2024-08-21 12:20:36 +02:00
kat-proxies = {
enable = true;
internal-webroot = pkgs.runCommand "watcher" { } ''
mkdir -p $out/.kat-watcher/
ln -nsf ${./error} $out/.kat-watcher/error
'';
};
2024-06-18 09:47:57 +02:00
2024-10-03 17:42:38 +02:00
environment.systemPackages = with pkgs; [ tcpdump ];
2024-06-18 09:47:57 +02:00
2024-10-14 17:04:43 +02:00
services.openssh.enable = true;
2024-06-18 09:47:57 +02:00
system.stateVersion = "23.11";
}