2024-01-18 14:59:17 +00:00
|
|
|
|
{ pkgs
|
|
|
|
|
, lib
|
|
|
|
|
, config
|
|
|
|
|
, repoFlake
|
|
|
|
|
, nodeName
|
|
|
|
|
, ...
|
|
|
|
|
}:
|
|
|
|
|
let
|
2023-08-22 10:20:16 +02:00
|
|
|
|
wireguardPort = 51820;
|
2024-01-18 14:59:17 +00:00
|
|
|
|
in
|
|
|
|
|
{
|
2023-11-25 09:19:31 +01:00
|
|
|
|
imports = [
|
|
|
|
|
../../snippets/systemd-resolved.nix
|
|
|
|
|
];
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
networking.firewall.enable = true;
|
2023-08-08 17:53:01 +02:00
|
|
|
|
networking.nftables.enable = true;
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
|
# iperf3
|
|
|
|
|
5201
|
|
|
|
|
];
|
2023-08-22 10:20:16 +02:00
|
|
|
|
networking.firewall.allowedUDPPorts = [
|
|
|
|
|
wireguardPort
|
|
|
|
|
];
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
networking.firewall.logRefusedConnections = false;
|
|
|
|
|
|
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
|
|
2023-03-08 19:13:59 +01:00
|
|
|
|
networking.dhcpcd.enable = false;
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
networking.interfaces.eth0 = {
|
|
|
|
|
mtu = 1400;
|
2024-01-18 14:59:17 +00:00
|
|
|
|
useDHCP = true;
|
2023-02-07 18:24:28 +01:00
|
|
|
|
ipv4.addresses = [
|
|
|
|
|
{
|
|
|
|
|
"address" = "167.233.1.14";
|
|
|
|
|
"prefixLength" = 29;
|
|
|
|
|
}
|
|
|
|
|
];
|
2024-01-18 14:59:17 +00:00
|
|
|
|
ipv6.addresses = [ ];
|
2020-11-25 21:53:26 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.defaultGateway = {
|
|
|
|
|
address = "167.233.1.9";
|
|
|
|
|
interface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.defaultGateway6 = {
|
|
|
|
|
address = "fe80::1";
|
|
|
|
|
interface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.nat = {
|
|
|
|
|
enable = true;
|
2024-01-18 14:59:17 +00:00
|
|
|
|
internalInterfaces = [ "ve-*" "wg*" ];
|
2020-11-25 21:53:26 +01:00
|
|
|
|
externalInterface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
2023-08-08 17:53:01 +02:00
|
|
|
|
networking.firewall.filterForward = true;
|
|
|
|
|
networking.firewall.extraForwardRules = ''
|
|
|
|
|
meta nfproto ipv4 tcp flags syn tcp option maxseg size set 1360;
|
|
|
|
|
meta nfproto ipv6 tcp flags syn tcp option maxseg size set 1340;
|
|
|
|
|
'';
|
2020-11-25 21:53:26 +01:00
|
|
|
|
|
2023-08-22 10:20:16 +02:00
|
|
|
|
sops.secrets.wg0-private.sopsFile = ../../../../secrets/${nodeName}/secrets.yaml;
|
|
|
|
|
sops.secrets.wg0-psk-steveej-psk.sopsFile = ../../../../secrets/${nodeName}/secrets.yaml;
|
|
|
|
|
|
|
|
|
|
networking.wireguard.enable = true;
|
|
|
|
|
networking.wireguard.interfaces.wg0 = {
|
|
|
|
|
# eth0 MTU (1400) - 80
|
|
|
|
|
mtu = 1320;
|
|
|
|
|
ips = [
|
|
|
|
|
"192.168.99.1/31"
|
|
|
|
|
];
|
|
|
|
|
listenPort =
|
|
|
|
|
wireguardPort;
|
|
|
|
|
privateKeyFile = config.sops.secrets.wg0-private.path;
|
|
|
|
|
peers = [
|
|
|
|
|
{
|
2024-01-18 14:59:17 +00:00
|
|
|
|
allowedIPs = [ "192.168.99.2/32" ];
|
2023-08-22 10:20:16 +02:00
|
|
|
|
publicKey = "O3k4jEdX6jkV1fHP/J8KSH5tvi+n1VvnBTD5na6Naw0=";
|
|
|
|
|
presharedKeyFile = config.sops.secrets.wg0-psk-steveej-psk.path;
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
# virtualization
|
2024-01-18 14:59:17 +00:00
|
|
|
|
virtualisation = { docker.enable = false; };
|
2020-11-25 21:53:26 +01:00
|
|
|
|
|
|
|
|
|
services.spice-vdagentd.enable = true;
|
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
|
|
2024-01-18 14:59:17 +00:00
|
|
|
|
nix.gc = { automatic = true; };
|
2020-11-25 21:53:26 +01:00
|
|
|
|
|
2023-03-08 19:13:59 +01:00
|
|
|
|
containers = {
|
2023-07-05 15:55:04 +02:00
|
|
|
|
|
2023-03-08 19:13:59 +01:00
|
|
|
|
};
|
2020-11-25 23:27:29 +01:00
|
|
|
|
|
2023-11-25 09:20:28 +01:00
|
|
|
|
home-manager.users.steveej = import ../../../home-manager/configuration/text-minimal.nix {
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-25 21:53:26 +01:00
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
2023-03-08 19:13:59 +01:00
|
|
|
|
system.stateVersion = "22.11"; # Did you read the comment?
|
2020-11-25 21:53:26 +01:00
|
|
|
|
}
|