{ pkgs, config, lib, ... }:

let
  domain = "devs.giugl.io";

  utilities = import ./utilities.nix { inherit lib config; };
  inherit (utilities) generateDeviceStrings;
in
{
  architect = {
    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}"; };
        ucsb-workstation = { address = "100.64.0.10"; hostname = "ucsb-workstation.${domain}"; };
        alfredo = { address = "100.64.0.9"; hostname = "alfredo.${domain}"; };
        parallels = { address = "100.64.0.3"; hostname = "parallels.${domain}"; };
      };
    };
  };

  services = {
    tailscale = {
      enable = true;
      interfaceName = config.architect.networks.tailscale.interface;
      package = pkgs.unstablePkgs.tailscale;
    };
  };

  networking.extraHosts = generateDeviceStrings config.architect.networks.tailscale.devices;
}