2023-03-22 22:26:02 +02:00
|
|
|
{ config, depot, lib, ... }:
|
2022-08-03 23:53:45 +03:00
|
|
|
|
|
|
|
let
|
2023-08-31 01:55:45 +03:00
|
|
|
inherit (depot) hours;
|
2022-08-03 23:53:45 +03:00
|
|
|
|
|
|
|
meshNet = rec {
|
|
|
|
netAddr = "10.1.1.0";
|
|
|
|
prefix = 24;
|
|
|
|
cidr = "${netAddr}/${toString prefix}";
|
|
|
|
};
|
|
|
|
|
2023-03-07 02:26:07 +02:00
|
|
|
getExtAddr = host: host.interfaces.primary.addrPublic;
|
2024-07-23 03:46:34 +03:00
|
|
|
|
|
|
|
snakeoilPublicKeys = {
|
|
|
|
checkmate = "TESTtbFybW5YREwtd18a1A4StS4YAIUS5/M1Lv0jHjA=";
|
|
|
|
grail = "TEsTh7bthkaDh9A1CpqDi/F121ao5lRZqIJznLH8mB4=";
|
|
|
|
thunderskin = "tEST6afFmVN18o+EiWNFx+ax3MJwdQIeNfJSGEpffXw=";
|
|
|
|
VEGAS = "tEsT6s7VtM5C20eJBaq6UlQydAha8ATlmrTRe9T5jnM=";
|
|
|
|
prophet = "TEstYyb5IoqSL53HbSQwMhTaR16sxcWcMmXIBPd+1gE=";
|
|
|
|
};
|
|
|
|
|
|
|
|
grease = hourName: realPublicKey: if config.simulacrum then
|
|
|
|
snakeoilPublicKeys.${hourName}
|
|
|
|
else
|
|
|
|
realPublicKey;
|
2022-08-03 23:53:45 +03:00
|
|
|
in
|
|
|
|
{
|
2022-08-05 00:25:37 +03:00
|
|
|
vars = {
|
2023-03-22 22:26:02 +02:00
|
|
|
mesh = lib.genAttrs config.services.wireguard.nodes.mesh (node: config.hostLinks.${node}.mesh.extra);
|
2022-08-05 00:25:37 +03:00
|
|
|
inherit meshNet;
|
2022-08-04 00:36:11 +03:00
|
|
|
};
|
2023-03-22 22:26:02 +02:00
|
|
|
hostLinks = {
|
|
|
|
checkmate.mesh = {
|
2023-03-07 02:26:07 +02:00
|
|
|
ipv4 = getExtAddr hours.checkmate;
|
2023-03-01 02:02:41 +02:00
|
|
|
extra = {
|
|
|
|
meshIp = "10.1.1.32";
|
|
|
|
inherit meshNet;
|
2024-07-23 03:46:34 +03:00
|
|
|
pubKey = grease "checkmate" "fZMB9CDCWyBxPnsugo3Uxm/TIDP3VX54uFoaoC0bP3U=";
|
2023-03-01 02:02:41 +02:00
|
|
|
extraRoutes = [];
|
|
|
|
};
|
|
|
|
};
|
2023-11-04 01:27:30 +02:00
|
|
|
grail.mesh = {
|
|
|
|
ipv4 = getExtAddr hours.grail;
|
|
|
|
extra = {
|
|
|
|
meshIp = "10.1.1.6";
|
|
|
|
inherit meshNet;
|
2024-07-23 03:46:34 +03:00
|
|
|
pubKey = grease "grail" "0WAiQGdWySsGWFUk+a9e0I+BDTKwTyWQdFT2d7BMfDQ=";
|
2023-11-04 01:27:30 +02:00
|
|
|
extraRoutes = [];
|
|
|
|
};
|
|
|
|
};
|
2023-03-22 22:26:02 +02:00
|
|
|
thunderskin.mesh = {
|
2023-03-20 20:52:07 +02:00
|
|
|
ipv4 = getExtAddr hours.thunderskin;
|
|
|
|
extra = {
|
|
|
|
meshIp = "10.1.1.4";
|
|
|
|
inherit meshNet;
|
2024-07-23 03:46:34 +03:00
|
|
|
pubKey = grease "thunderskin" "xvSsFvCVK8h2wThZJ7E5K0fniTBIEIYOblkKIf3Cwy0=";
|
2023-03-20 20:52:07 +02:00
|
|
|
extraRoutes = [];
|
|
|
|
};
|
|
|
|
};
|
2023-03-22 22:26:02 +02:00
|
|
|
VEGAS.mesh = {
|
2023-03-07 02:26:07 +02:00
|
|
|
ipv4 = getExtAddr hours.VEGAS;
|
2022-08-03 23:53:45 +03:00
|
|
|
extra = {
|
|
|
|
meshIp = "10.1.1.5";
|
|
|
|
inherit meshNet;
|
2024-07-23 03:46:34 +03:00
|
|
|
pubKey = grease "VEGAS" "NpeB8O4erGTas1pz6Pt7qtY9k45YV6tcZmvvA4qXoFk=";
|
2023-03-07 02:26:07 +02:00
|
|
|
extraRoutes = [ "${hours.VEGAS.interfaces.vstub.addr}/32" "10.10.0.0/16" ];
|
2022-08-03 23:53:45 +03:00
|
|
|
};
|
|
|
|
};
|
2023-03-22 22:26:02 +02:00
|
|
|
prophet.mesh = {
|
2023-03-07 02:26:07 +02:00
|
|
|
ipv4 = getExtAddr hours.prophet;
|
2022-08-03 23:53:45 +03:00
|
|
|
extra = {
|
|
|
|
meshIp = "10.1.1.9";
|
|
|
|
inherit meshNet;
|
2024-07-23 03:46:34 +03:00
|
|
|
pubKey = grease "prophet" "MMZAbRtNE+gsLm6DJy9VN/Y39E69oAZnvOcFZPUAVDc=";
|
2022-08-04 01:27:21 +03:00
|
|
|
extraRoutes = [];
|
2022-08-03 23:53:45 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.wireguard = {
|
|
|
|
nodes = {
|
2023-11-04 01:27:30 +02:00
|
|
|
mesh = [ "checkmate" "grail" "thunderskin" "VEGAS" "prophet" ];
|
2024-07-22 00:35:11 +03:00
|
|
|
storm = [ "VEGAS" ];
|
2022-08-03 23:53:45 +03:00
|
|
|
};
|
|
|
|
nixos = {
|
2024-07-23 03:46:34 +03:00
|
|
|
mesh = [
|
|
|
|
./mesh.nix
|
|
|
|
] ++ lib.optionals config.simulacrum [
|
|
|
|
./simulacrum/snakeoil-keys.nix
|
|
|
|
];
|
|
|
|
storm = [ ./storm.nix ];
|
2022-08-03 23:53:45 +03:00
|
|
|
};
|
2024-07-08 18:45:20 +03:00
|
|
|
secrets.meshPrivateKey = {
|
|
|
|
nodes = config.services.wireguard.nodes.mesh;
|
|
|
|
shared = false;
|
|
|
|
};
|
2024-08-13 19:51:26 +03:00
|
|
|
simulacrum = {
|
|
|
|
enable = true;
|
|
|
|
settings = ./test.nix;
|
|
|
|
};
|
2022-08-03 23:53:45 +03:00
|
|
|
};
|
|
|
|
}
|