2024-08-29 03:26:04 +02:00
|
|
|
{
|
|
|
|
ipv4,
|
|
|
|
ipv6,
|
|
|
|
config,
|
|
|
|
optionalString,
|
|
|
|
concatStringsSep,
|
|
|
|
factsGenerator,
|
|
|
|
mapAttrsToList,
|
|
|
|
clanLib,
|
|
|
|
...
|
2023-01-26 21:29:47 +01:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
hosts = {
|
|
|
|
bobi = "10.23.42.25";
|
2023-12-17 13:06:57 +01:00
|
|
|
cherry = "10.23.42.29";
|
2024-08-05 16:56:42 +02:00
|
|
|
chungus = "10.23.42.28";
|
|
|
|
cream = "10.23.42.27";
|
|
|
|
mobi = "10.23.42.23";
|
2024-03-03 21:58:52 +01:00
|
|
|
orbi = "10.23.42.100";
|
2023-01-26 21:29:47 +01:00
|
|
|
};
|
|
|
|
subDomains = {
|
2024-03-03 21:58:52 +01:00
|
|
|
# orbi
|
2024-04-07 10:18:13 +02:00
|
|
|
"transmission2.orbi" = hosts.orbi;
|
|
|
|
"sonarr.orbi" = hosts.orbi;
|
|
|
|
"radarr.orbi" = hosts.orbi;
|
2024-08-05 16:56:42 +02:00
|
|
|
"lidarr.orbi" = hosts.orbi;
|
2024-04-07 10:18:13 +02:00
|
|
|
"prowlarr.orbi" = hosts.orbi;
|
2024-05-10 20:53:21 +02:00
|
|
|
"photoprism.orbi" = hosts.orbi;
|
2023-05-01 15:21:15 +02:00
|
|
|
# chungus
|
2024-08-18 13:38:02 +02:00
|
|
|
"video.chungus" = hosts.chungus;
|
2023-10-05 16:30:34 +02:00
|
|
|
"de.tts.chungus" = hosts.chungus;
|
|
|
|
"en.tts.chungus" = hosts.chungus;
|
2023-05-14 02:59:03 +02:00
|
|
|
"flix.chungus" = hosts.chungus;
|
2023-10-05 16:30:34 +02:00
|
|
|
"git.chungus" = hosts.chungus;
|
2023-05-01 15:21:15 +02:00
|
|
|
"grafana.chungus" = hosts.chungus;
|
2023-05-14 02:59:03 +02:00
|
|
|
"loki.chungus" = hosts.chungus;
|
2023-05-01 15:21:15 +02:00
|
|
|
"prometheus.chungus" = hosts.chungus;
|
2023-10-05 16:30:34 +02:00
|
|
|
"s3.chungus" = hosts.chungus;
|
2024-01-07 00:27:29 +01:00
|
|
|
"minio.chungus" = hosts.chungus;
|
2023-05-03 21:20:51 +02:00
|
|
|
"sync.chungus" = hosts.chungus;
|
2023-05-14 02:59:03 +02:00
|
|
|
"tdarr.chungus" = hosts.chungus;
|
|
|
|
"tts.chungus" = hosts.chungus;
|
2024-03-04 19:05:30 +01:00
|
|
|
"paperless.chungus" = hosts.chungus;
|
2023-01-26 21:29:47 +01:00
|
|
|
};
|
|
|
|
network = "private";
|
2024-06-07 09:42:26 +02:00
|
|
|
Ed25519PublicKey = clanLib.readFact "tinc.private.ed25519_key.pub";
|
2023-01-26 21:29:47 +01:00
|
|
|
in
|
2022-10-13 10:51:21 +02:00
|
|
|
{
|
2023-01-26 21:29:47 +01:00
|
|
|
networking.firewall.trustedInterfaces = [ "tinc.${network}" ];
|
2022-10-13 10:51:21 +02:00
|
|
|
|
2024-06-19 13:19:55 +02:00
|
|
|
clan.core.facts.services.tinc_private = factsGenerator.tinc { name = "private"; };
|
2022-10-13 10:51:21 +02:00
|
|
|
|
2023-01-26 21:29:47 +01:00
|
|
|
services.tinc.networks = {
|
|
|
|
${network} = {
|
2024-08-29 03:26:04 +02:00
|
|
|
ed25519PrivateKeyFile =
|
|
|
|
config.clan.core.facts.services.tinc_private.secret."tinc.private.ed25519_key.priv".path;
|
2023-01-26 21:29:47 +01:00
|
|
|
interfaceType = "tap";
|
|
|
|
extraConfig = ''
|
|
|
|
LocalDiscovery = yes
|
|
|
|
'';
|
|
|
|
hostSettings = {
|
|
|
|
mobi = {
|
2024-08-29 03:26:04 +02:00
|
|
|
subnets = [ { address = hosts.mobi; } ];
|
2023-01-26 21:29:47 +01:00
|
|
|
settings.Ed25519PublicKey = "X5sp3YYevVNUrzYvi+HZ2iW5WbO0bIb58jR4jZFH6MB";
|
|
|
|
};
|
2024-06-05 13:33:33 +02:00
|
|
|
bobi = {
|
2024-08-29 03:26:04 +02:00
|
|
|
subnets = [ { address = hosts.bobi; } ];
|
2024-06-05 13:33:33 +02:00
|
|
|
settings.Ed25519PublicKey = "jwvNd4oAgz2cWEI74VTVYU1qgPWq823/a0iEDqJ8KMD";
|
|
|
|
};
|
2023-02-13 18:40:56 +01:00
|
|
|
cream = {
|
2024-08-29 03:26:04 +02:00
|
|
|
subnets = [ { address = hosts.cream; } ];
|
2024-06-05 13:33:33 +02:00
|
|
|
settings.Ed25519PublicKey = Ed25519PublicKey "cream";
|
2023-02-13 18:40:56 +01:00
|
|
|
};
|
2023-12-17 13:06:57 +01:00
|
|
|
cherry = {
|
2024-08-29 03:26:04 +02:00
|
|
|
subnets = [ { address = hosts.cherry; } ];
|
2024-06-05 13:33:33 +02:00
|
|
|
settings.Ed25519PublicKey = Ed25519PublicKey "cherry";
|
2023-01-26 21:29:47 +01:00
|
|
|
};
|
2023-04-30 00:47:46 +02:00
|
|
|
chungus = {
|
2024-08-29 03:26:04 +02:00
|
|
|
subnets = [ { address = hosts.chungus; } ];
|
2024-06-05 13:33:33 +02:00
|
|
|
settings.Ed25519PublicKey = Ed25519PublicKey "chungus";
|
2023-01-26 21:29:47 +01:00
|
|
|
};
|
2024-03-03 21:58:52 +01:00
|
|
|
orbi = {
|
2024-08-29 03:26:04 +02:00
|
|
|
addresses = [ { address = "95.216.66.212"; } ];
|
|
|
|
subnets = [ { address = hosts.orbi; } ];
|
2024-06-05 13:33:33 +02:00
|
|
|
settings.Ed25519PublicKey = Ed25519PublicKey "orbi";
|
2024-03-03 21:58:52 +01:00
|
|
|
};
|
2023-01-26 21:29:47 +01:00
|
|
|
};
|
|
|
|
};
|
2022-10-13 10:51:21 +02:00
|
|
|
};
|
|
|
|
|
2023-01-26 21:29:47 +01:00
|
|
|
systemd.network.enable = true;
|
|
|
|
systemd.network.networks.${network}.extraConfig = ''
|
|
|
|
[Match]
|
|
|
|
Name = tinc.${network}
|
|
|
|
[Link]
|
|
|
|
# tested with `ping -6 turingmachine.r -s 1378`, not sure how low it must be
|
|
|
|
MTUBytes=1377
|
|
|
|
[Network]
|
|
|
|
${optionalString (ipv4 != null) "Address=${ipv4}/24"}
|
|
|
|
${optionalString (ipv6 != null) "Address=${ipv6}/28"}
|
|
|
|
RequiredForOnline = no
|
|
|
|
LinkLocalAddressing = no
|
|
|
|
'';
|
|
|
|
|
2024-08-29 03:26:04 +02:00
|
|
|
networking.extraHosts = concatStringsSep "\n" (
|
|
|
|
mapAttrsToList (name: ip: "${ip} ${name}.${network}") (hosts // subDomains)
|
|
|
|
);
|
2023-01-26 21:29:47 +01:00
|
|
|
|
2022-10-13 10:51:21 +02:00
|
|
|
}
|