nixos-config/machines/fort.nix
Christoph Heiss 243e668be0
machines: fort: Enable IPv4 forwarding
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-10-13 19:51:31 +02:00

89 lines
2.2 KiB
Nix

{ my, pkgs, ... }:
let
hetznerWanIfName = "enp1s0";
hetznerWanNetwork = {
matchConfig.Name = hetznerWanIfName;
routes = [{
routeConfig = {
Gateway = "172.31.1.1";
GatewayOnLink = true;
};
}];
dns = [ "185.12.64.1" "185.12.64.2" ];
linkConfig.RequiredForOnline = "routable";
};
in {
imports = [
../secrets/morph/acme.nix
../secrets/morph/wireguard
../secrets/web.nix
../services/fail2ban.nix
../services/nginx.nix
../services/web/c8h4-io.nix
../system/virtual-machine.nix
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "sd_mod" "sr_mod" ];
boot.loader.systemd-boot.enable = false;
boot.loader.grub = {
enable = true;
device = "/dev/sda";
};
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
system.stateVersion = "23.05";
fileSystems."/" = {
device = "/dev/disk/by-uuid/0ec38da7-36b2-437c-b4dd-45d5ed620979";
fsType = "btrfs";
options = [ "noatime" "subvol=@" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/0ec38da7-36b2-437c-b4dd-45d5ed620979";
fsType = "btrfs";
options = [ "noatime" "subvol=@boot" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/0ec38da7-36b2-437c-b4dd-45d5ed620979";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/0ec38da7-36b2-437c-b4dd-45d5ed620979";
fsType = "btrfs";
options = [ "noatime" "compress=zstd" "subvol=@nix" ];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/0ec38da7-36b2-437c-b4dd-45d5ed620979";
fsType = "btrfs";
options = [ "noatime" "compress=zstd" "subvol=@log" ];
};
environment.systemPackages = with pkgs; [ wireguard-tools ];
networking.firewall.allowedUDPPorts = with my.wireguard.netdevs; [
c8h4.wireguardConfig.ListenPort
airlab.wireguardConfig.ListenPort
];
systemd.network = {
enable = true;
networks = {
"10-wan" = hetznerWanNetwork // { address = [ "128.140.95.112/32" ]; };
"40-wg-c8h4" = my.wireguard.networks.c8h4;
"41-wg-airlab" = my.wireguard.networks.airlab;
};
netdevs = {
"40-wg-c8h4" = my.wireguard.netdevs.c8h4;
"41-wg-airlab" = my.wireguard.netdevs.airlab;
};
};
}