feat: introduce awareness module for WAN addresses
Introduce a data-only module to perform abstraction on the deployment, we use it for WAN for now. The usecase is service discovery for simple cases. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
parent
7df7eaeb9b
commit
6441a01ab1
|
@ -1,7 +1,7 @@
|
|||
{ 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 = [
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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" ];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
./matrix
|
||||
./monitoring
|
||||
./uptime-kuma
|
||||
./self
|
||||
./netbox
|
||||
./ofborg
|
||||
./postgres
|
||||
|
|
21
services/self/default.nix
Normal file
21
services/self/default.nix
Normal file
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue