nix/network/options.nix
Jeltz a64b34810d
wip: nixpkgs versions + infra network + monitoring
Signed-off-by: Jeltz <jeltz@federez.net>
2025-04-05 21:26:29 +02:00

127 lines
3.2 KiB
Nix

{ lib, ... }:
let
nodeSubmodule = lib.types.submodule {
options = {
id = lib.mkOption {
type = lib.types.ints.between 1 65535;
description = ''
Identifiant du nœud.
'';
example = 350;
};
ipv4 = lib.mkOption {
type = lib.types.str;
description = ''
Adresse IPv4 interne du nœud.
'';
example = "10.42.1.94";
};
ipv6 = lib.mkOption {
type = lib.types.str;
description = ''
Adresse IPv6 interne du nœud.
'';
example = "fd0a:66d3:1c19:42::1:94";
};
mac = lib.mkOption {
type = lib.types.str;
description = ''
Adresse MAC interne du nœud.
'';
example = "42:42:42:00:10:94";
};
};
};
hubSubmodule = lib.types.submodule {
options = {
id = lib.mkOption {
type = lib.types.ints.between 1 254;
description = ''
Identifiant du concentrateur.
'';
example = 12;
};
publicKey = lib.mkOption {
type = lib.types.str;
description = ''
Clé publique du concentrateur.
'';
example = "pn8PoOZnlT+CUjI0lyILNhj7/7TMaNr+DmWbtWyj+Bg=";
};
endpoint = lib.mkOption {
type = lib.types.str;
description = ''
Adresse et port publics du concentrateur.
'';
example = "1.2.3.4:54050";
};
ipv6 = lib.mkOption {
type = lib.types.str;
description = ''
Adresse IPv6 interne du concentrateur.
'';
example = "fd0a:66d3:1c19:1000::12";
};
};
};
in {
options = {
infra = {
vxlan = {
vni = lib.mkOption {
type = lib.types.ints.between 1 16777215;
description = ''
Identifiant de VXLAN du réseau INFRA.
'';
example = 42;
};
port = lib.mkOption {
type = lib.types.port;
description = ''
Numéro de port du trafic VXLAN.
'';
example = 4789;
};
};
cidr = {
nodes = {
ipv4 = lib.mkOption {
type = lib.types.ints.between 1 32;
description = ''
Taille du réseau IPv4 interne des nœuds INFRA.
'';
example = 16;
};
ipv6 = lib.mkOption {
type = lib.types.ints.between 1 128;
description = ''
Taille du réseau IPv6 interne des nœuds INFRA.
'';
example = 64;
};
};
hubs.ipv6 = lib.mkOption {
type = lib.types.ints.between 1 128;
description = ''
Taille du réseau IPv6 interne des concentrateurs INFRA.
'';
example = 64;
};
};
nodes = lib.mkOption {
type = lib.types.attrsOf nodeSubmodule;
default = { };
description = ''
Nœuds du réseau INFRA.
'';
};
hubs = lib.mkOption {
type = lib.types.attrsOf hubSubmodule;
default = { };
description = ''
Concentrateurs du réseau INFRA.
'';
};
};
};
}