nix-config/hosts/containers/yggdrasil/default.nix

82 lines
1.7 KiB
Nix

{ hostRegistry, ... }:
let
yggAddress = "201:4561:bb58:4dac:5f6a:7b23:44f:a5ef";
yggPrefix = "301:4561:bb58:4dac"; # 301:4561:bb58:4dac::/64
# taken from the output of "yggdrasilctl getself".
in {
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;
# Forward traffic under the prefix.
boot.postBootCommands = ''
if [ ! -c /dev/net/tun ]; then
mkdir -p /dev/net
mknod -m 666 /dev/net/tun c 10 200
fi
'';
c3d2 = { isInHq = true; };
networking = let host = hostRegistry.hosts.yggdrasil;
in {
hostName = "yggdrasil";
defaultGateway = "172.20.72.6";
defaultGateway6 = "2a02:8106:208:5281::b:0";
nameservers = [ "172.20.73.8" ];
interfaces.eth0 = {
ipv4 = {
addresses = [{
address = host.ip4;
prefixLength = 26;
}];
};
ipv6 = {
addresses = [
{
address = host.ip6;
prefixLength = 64;
}
{
address = yggPrefix + "::1";
prefixLength = 64;
}
];
};
};
};
services.yggdrasil = {
enable = true;
persistentKeys = true;
config = {
Peers = [
# deutschland
"tcp://45.11.19.26:5001"
# czechia
"tcp://[2a03:3b40:fe:ab::1]:46370"
"tcp://[2a05:9403::8b]:7743"
# polen
"tcp://[2001:41d0:601:1100::cf2]:37145"
];
NodeInfo = {
# This information is visible to the network.
name = "y.c3d2.de";
location = "Dresden";
email = "ehmry@c3d2.de";
};
};
};
services.nginx = {
enable = true;
virtualHosts."y.c3d2.de" = {
default = true;
locations."/".proxyPass = "https://c3d2.de";
};
};
}