diff --git a/common/hardware/raito-vm.nix b/common/hardware/raito-vm.nix index d17373d..0ae4e64 100644 --- a/common/hardware/raito-vm.nix +++ b/common/hardware/raito-vm.nix @@ -1,7 +1,7 @@ -{ lib, config, ... }: +{ lib, config, ... }: let cfg = config.bagel.hardware.raito-vm; - inherit (lib) mkEnableOption mkIf mkOption types; + inherit (lib) mkEnableOption mkIf mkOption types split toIntBase10; in { options.bagel.hardware.raito-vm = { @@ -54,6 +54,17 @@ in linkConfig.Name = "wan"; }; + bagel.infra.self.wan = + let + parts = split "/" cfg.networking.wan.address; + address = builtins.elemAt parts 0; + prefixLength = toIntBase10 (builtins.elemAt 1 parts); + in + { + family = "inet6"; + inherit address prefixLength; + }; + boot.loader.systemd-boot.enable = true; boot.initrd.kernelModules = [ diff --git a/hosts/build-coord/hardware.nix b/hosts/build-coord/hardware.nix index dbd7cb6..c84896a 100644 --- a/hosts/build-coord/hardware.nix +++ b/hosts/build-coord/hardware.nix @@ -72,6 +72,12 @@ ]; networking.defaultGateway6 = { interface = "uplink"; address = "2a01:584:11::1"; }; + bagel.infra.self.wan = { + family = "inet6"; + address = "2a01:584:11::1:11"; + prefixLength = 64; + }; + services.coredns = { enable = true; config = '' diff --git a/services/baremetal-builder/default.nix b/services/baremetal-builder/default.nix index fd9075a..f79d3fc 100644 --- a/services/baremetal-builder/default.nix +++ b/services/baremetal-builder/default.nix @@ -135,6 +135,11 @@ in { address = "2a01:584:11::1:${toString cfg.num}"; prefixLength = 64; } ]; networking.defaultGateway6 = { interface = "uplink"; address = "2a01:584:11::1"; }; + bagel.infra.self.wan = { + family = "inet6"; + address = "2a01:584:11::1:${toString cfg.num}"; + prefixLength = 64; + }; deployment.targetHost = "2a01:584:11::1:${toString cfg.num}"; deployment.tags = [ "builders" ]; diff --git a/services/default.nix b/services/default.nix index 08a2272..d0971ec 100644 --- a/services/default.nix +++ b/services/default.nix @@ -7,6 +7,7 @@ ./matrix ./monitoring ./uptime-kuma + ./self ./netbox ./ofborg ./postgres diff --git a/services/self/default.nix b/services/self/default.nix new file mode 100644 index 0000000..c761c99 --- /dev/null +++ b/services/self/default.nix @@ -0,0 +1,21 @@ +# This is a data-only module for other modules consumption. +{ lib, ... }: +let + inherit (lib) mkOption types; +in +{ + options.bagel.infra.self = { + wan = { + family = mkOption { + type = types.enum [ "inet" "inet6" ]; + default = "inet6"; + }; + address = mkOption { + type = types.str; + }; + prefixLength = mkOption { + type = types.int; + }; + }; + }; +}