architect: Moved tailscale config to new network attribute set

This commit is contained in:
Giulio De Pasquale 2023-05-12 12:50:20 +02:00
parent 26a07a20e5
commit 65c76f5a6a

View File

@ -1,24 +1,38 @@
{ config, lib, ... }: { config, lib, ... }:
let let
network = import ./network.nix; domain = "devs.giugl.io";
# device.address device.hostname
ifname = "ts0"; generateDeviceStrings = devices: lib.concatStringsSep "\n"
(lib.mapAttrsToList (name: device: "${device.address} ${device.hostname}") devices);
in in
{ {
architect.firewall.openUDP = [ config.services.tailscale.port ]; architect = {
firewall.openUDP = [ config.services.tailscale.port ];
networks.tailscale = {
interface = "ts0";
net = "100.64.0.0/10";
devices = {
architect = { address = "100.64.0.1"; hostname = "architect.${domain}"; };
kmerr = { address = "100.64.0.2"; hostname = "kmerr.${domain}"; };
chuck = { address = "100.64.0.4"; hostname = "chuck.${domain}"; };
dodino = { address = "100.64.0.5"; hostname = "dodino.${domain}"; };
manduria = { address = "100.64.0.6"; hostname = "manduria.${domain}"; };
tommy = { address = "100.64.0.7"; hostname = "tommy.${domain}"; };
ucsb-workstation = { address = "100.64.0.8"; hostname = "ucsb-workstation.${domain}"; };
alfredo = { address = "100.64.0.9"; hostname = "alfredo.${domain}"; };
};
};
};
services = { services = {
tailscale = { tailscale = {
enable = true; enable = true;
interfaceName = ifname; interfaceName = config.architect.networks.tailscale.interface;
}; };
}; };
networking.extraHosts = '' networking.extraHosts = generateDeviceStrings config.architect.networks.tailscale.devices;
${network.architect-ts} architect.devs.giugl.io
${network.giuliopc-ts} kmerr.devs.giugl.io
${network.dodino-ts} dodino.devs.giugl.io
${network.giuliophone-ts} chuck.devs.giugl.io
'';
} }