diff --git a/flake.nix b/flake.nix index 9601dd4..5797bcc 100644 --- a/flake.nix +++ b/flake.nix @@ -264,6 +264,10 @@ overlays = [ inputs.nix-topology.overlays.default ]; }; + specialArgs = { + values = import ./values.nix; + }; + modules = [ ./topology { diff --git a/topology/default.nix b/topology/default.nix index a34f454..fda50ec 100644 --- a/topology/default.nix +++ b/topology/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ config, pkgs, lib, values, ... }: let inherit (config.lib.topology) @@ -8,7 +8,6 @@ let mkDevice mkConnection mkConnectionRev; - values = import ../values.nix; in { imports = [ ./non-nixos-machines.nix @@ -53,7 +52,7 @@ in { nodes.ntnu-pvv-router = mkRouter "NTNU PVV Gateway" { interfaceGroups = [ ["wan1"] ["eth1"] ]; - connections.eth1 = mkConnection "brus-switch" "eth1"; + connections.eth1 = mkConnection "brus-switch" "eth0"; interfaces.eth1.network = "pvv"; }; @@ -63,7 +62,7 @@ in { connections = let connections' = [ (mkConnection "bekkalokk" "enp2s0") - # (mkConnection "bicep" "enp6s0f0") + # (mkConnection "bicep" "enp6s0f0") # NOTE: physical machine is dead at the moment (mkConnection "buskerud" "eth1") (mkConnection "knutsen" "eth1") (mkConnection "powerpuff-cluster" "eth1") @@ -75,13 +74,13 @@ in { (mkConnection "innovation" "em0") (mkConnection "microbel" "eth0") # (mkConnection "isvegg" "") - # (mkConnection "ameno" "") - # (mkConnection "sleipner" "") + (mkConnection "ameno" "eth0") + (mkConnection "sleipner" "eno0") ]; in builtins.listToAttrs ( lib.zipListsWith (a: b: lib.nameValuePair a b) - (lib.genList (i: "eth${toString i}") 16) + (lib.genList (i: "eth${toString (i + 1)}") 15) connections' ); }; @@ -133,17 +132,35 @@ in { nodes.ludvigsen = mkRouter "ludvigsen" { interfaceGroups = [ ["eth1"] ["eth2"] ["vpn1"] ]; - connections.eth2 = mkConnection "pvv-switch" "eth1"; + connections.eth2 = mkConnection "pvv-switch" "eth0"; + interfaces.vpn1.network = "site-vpn"; interfaces.vpn1.virtual = true; + interfaces.vpn1.icon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/openvpn.svg"; + interfaces.eth1.network = "ntnu"; interfaces.eth2.network = "pvv"; }; nodes.pvv-switch = mkSwitch "PVV Switch (Terminalrommet)" { - interfaceGroups = [ ["eth1" "eth2" "eth3"] ]; - connections.eth2 = mkConnection "brzeczyszczykiewicz" "eno1"; - connections.eth3 = mkConnection "georg" "eno1"; + interfaceGroups = [ (lib.genList (i: "eth${toString i}") 16) ]; + connections = let + connections' = [ + (mkConnection "brzeczyszczykiewicz" "eno1") + (mkConnection "georg" "eno1") + (mkConnection "wegonke" "enp4s0") + (mkConnection "demiurgen" "eno1") + (mkConnection "sanctuary" "ethernet_0") + # (mkConnection "torskas" "") + # (mkConnection "skrott" "") + # (mkConnection "principal" "") + ]; + in builtins.listToAttrs ( + lib.zipListsWith + (a: b: lib.nameValuePair a b) + (lib.genList (i: "eth${toString (i + 1)}") 15) + connections' + ); }; diff --git a/topology/icons/bind9.png b/topology/icons/bind9.png new file mode 100644 index 0000000..cf781af Binary files /dev/null and b/topology/icons/bind9.png differ diff --git a/topology/non-nixos-machines.nix b/topology/non-nixos-machines.nix index 77222a6..0da9140 100644 --- a/topology/non-nixos-machines.nix +++ b/topology/non-nixos-machines.nix @@ -1,24 +1,109 @@ -{ config, lib, ... }: +{ config, pkgs, lib, values, ... }: let inherit (config.lib.topology) mkDevice; in { nodes.balduzius = mkDevice "balduzius" { guestType = "proxmox"; parent = config.nodes.powerpuff-cluster.id; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + + interfaceGroups = [ [ "ens18" ] ]; + interfaces.ens18 = { + mac = "00:0c:29:de:05:0f"; + addresses = [ + "129.241.210.192" + "2001:700:300:1900::1:42" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; + + services = { + kdc = { + name = "Heimdal KDC"; + info = "kdc.pvv.ntnu.no"; + details.kdc.text = "0.0.0.0:88"; + details.kpasswd.text = "0.0.0.0:464"; + }; + }; }; nodes.tom = mkDevice "tom" { guestType = "proxmox"; parent = config.nodes.powerpuff-cluster.id; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + + interfaceGroups = [ [ "ens18" ] ]; + interfaces.ens18 = { + mac = "00:0c:29:4d:f7:56"; + addresses = [ + "129.241.210.180" + "2001:700:300:1900::180" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; + + services = { + apache2 = { + name = "Apache2 - user websites"; + info = "www.pvv.ntnu.no/~"; + details.listen.text = "0.0.0.0:443"; + }; + }; }; nodes.hildring = mkDevice "hildring" { guestType = "proxmox"; parent = config.nodes.powerpuff-cluster.id; - }; - nodes.microbel = mkDevice "microbel" { + deviceType = "loginbox"; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + interfaceGroups = [ [ "eth0" ] ]; + interfaces.eth0 = { + mac = "00:0c:29:e7:dd:79"; + addresses = [ + "129.241.210.176" + "2001:700:300:1900::1:9" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; + }; + nodes.drolsum = mkDevice "drolsum" { + guestType = "proxmox"; + parent = config.nodes.powerpuff-cluster.id; + deviceType = "loginbox"; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + }; + + nodes.microbel = mkDevice "microbel" { + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + + hardware.info = "Supermicro X8ST3"; + + interfaceGroups = [ [ "eth0" "eth1" ] ]; + interfaces.eth0 = { + mac = "00:25:90:24:76:2c"; + addresses = [ + "129.241.210.179" + "2001:700:300:1900::1:2" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; }; nodes.innovation = mkDevice "innovation" { + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/freebsd.svg"; + hardware.info = "Dell Optiplex 9010"; + interfaceGroups = [ [ "em0" ] ]; interfaces.em0 = { mac = "18:03:73:20:18:d3"; @@ -27,8 +112,8 @@ in { "2001:700:300:1900::1:56" ]; gateways = [ - "129.241.210.129" - "2001:700:300:1900::1" + values.hosts.gateway + values.hosts.gateway6 ]; }; services = { @@ -41,35 +126,117 @@ in { }; }; nodes.principal = mkDevice "principal" { + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/freebsd.svg"; + interfaceGroups = [ [ ] ]; }; nodes.sleipner = mkDevice "sleipner" { + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + interfaceGroups = [ [ "eno0" "enp2s0" ] ]; + interfaces.enp2s0 = { + mac = "00:25:90:57:35:8e"; + addresses = [ + "129.241.210.193" + "2001:700:300:1900:fab:cab:dab:7ab" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; }; nodes.isvegg = mkDevice "isvegg" { + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + interfaceGroups = [ [ ] ]; }; nodes.ameno = mkDevice "ameno" { - interfaceGroups = [ [ ] ]; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/ubuntu.svg"; + + interfaceGroups = [ [ "eth0" ] ]; + interfaces.eth0 = { + mac = "b8:27:eb:62:1d:d8"; + addresses = [ + "129.241.210.230" + "129.241.210.211" + "129.241.210.153" + "2001:700:300:1900:ba27:ebff:fe62:1dd8" + "2001:700:300:1900::4:230" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; + services = { + bind = { + name = "Bind DNS"; + icon = ./icons/bind9.png; + info = "hostmaster.pvv.ntnu.no"; + details.listen.text = "0.0.0.0:53"; + }; + }; }; nodes.skrott = mkDevice "skrott" { - deviceType = "terminal"; interfaceGroups = [ [ ] ]; }; nodes.torskas = mkDevice "torskas" { - deviceType = "terminal"; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/arch_linux.svg"; + interfaceGroups = [ [ ] ]; }; nodes.wegonke = mkDevice "wegonke" { deviceType = "terminal"; - interfaceGroups = [ [ ] ]; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + + hardware.info = "ASUSTeK G11CD-K"; + + interfaceGroups = [ [ "enp4s0" ] ]; + interfaces.enp4s0 = { + mac = "70:4d:7b:a3:32:57"; + addresses = [ + "129.241.210.218" + "2001:700:300:1900::1:218" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; }; nodes.demiurgen = mkDevice "demiurgen" { deviceType = "terminal"; - interfaceGroups = [ [ ] ]; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/debian.svg"; + + interfaceGroups = [ [ "eno1" ] ]; + interfaces.eno1 = { + mac = "18:03:73:1f:f4:1f"; + addresses = [ + "129.241.210.201" + "2001:700:300:1900::1:4e" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; }; + nodes.sanctuary = mkDevice "sanctuary" { deviceType = "terminal"; - interfaceGroups = [ [ ] ]; + deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/windows.svg"; + + interfaceGroups = [ [ "ethernet_0" ] ]; + interfaces.ethernet_0 = { + addresses = [ + "129.241.210.170" + "2001:700:300:1900::1337" + ]; + gateways = [ + values.hosts.gateway + values.hosts.gateway6 + ]; + }; }; }