mirror of https://gitlab.crans.org/nounous/nixos
remove vlans and config -> infra
parent
cbf1a0bef9
commit
c81068ba8e
|
|
@ -13,7 +13,7 @@ let
|
|||
warn
|
||||
;
|
||||
|
||||
cransConfig = import ../config;
|
||||
infra = import ../infra;
|
||||
get_hosts_names = path: attrNames (filterAttrs (name: type: type == "directory") (readDir path));
|
||||
get_info =
|
||||
path:
|
||||
|
|
@ -30,7 +30,7 @@ let
|
|||
filePath
|
||||
];
|
||||
specialArgs = {
|
||||
crans = cransConfig;
|
||||
inherit infra;
|
||||
};
|
||||
}).config
|
||||
else
|
||||
|
|
@ -48,8 +48,7 @@ rec {
|
|||
nixosSystem {
|
||||
specialArgs = inputs // {
|
||||
hosts = all_hosts;
|
||||
crans = cransConfig;
|
||||
inherit info;
|
||||
inherit info infra;
|
||||
};
|
||||
modules = [
|
||||
(path + "/${name}")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
crans,
|
||||
info,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
optional
|
||||
;
|
||||
in
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
crans,
|
||||
infra,
|
||||
info,
|
||||
...
|
||||
}:
|
||||
|
|
@ -55,7 +55,7 @@ in
|
|||
"ipv6" = null;
|
||||
}
|
||||
)
|
||||
) (filterAttrs (n: _: cfg-net.${n}.enable) crans.vlans); # On filtre les interfaces désactivées.
|
||||
) (filterAttrs (n: _: cfg-net.${n}.enable) infra.vlans); # On filtre les interfaces désactivées.
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,230 +0,0 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
mkDefault
|
||||
mkForce
|
||||
;
|
||||
|
||||
vlanConf = {
|
||||
|
||||
srv = {
|
||||
id = 2;
|
||||
description = "Réseau public";
|
||||
interface = "ens19";
|
||||
ipv4 = {
|
||||
address = mkForce "185.230.79.0";
|
||||
prefixLength = 26;
|
||||
routes = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
via = "185.230.79.62";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
};
|
||||
ipv6 = {
|
||||
address = mkForce "2a0c:700:10::";
|
||||
routes = [
|
||||
{
|
||||
address = "::";
|
||||
via = "2a0c:700:2::ff:fe00:9902";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
srv-nat = {
|
||||
id = 3;
|
||||
description = "Réseau derrière un NAT";
|
||||
interface = "ens19";
|
||||
ipv4.routes = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
via = "172.16.3.99";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
ipv6 = {
|
||||
address = mkForce "2a0c:700:3::";
|
||||
routes = [
|
||||
{
|
||||
address = "::";
|
||||
via = "2a0c:700:3::ff:fe00:9903";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
san = {
|
||||
id = 4;
|
||||
description = "Accès aux baies de stockages";
|
||||
interface = "ens19";
|
||||
};
|
||||
|
||||
ceph = {
|
||||
id = 6;
|
||||
description = "Réseau interne à ceph";
|
||||
interface = "ens20";
|
||||
};
|
||||
|
||||
adm = {
|
||||
id = 10;
|
||||
description = "Réseau interne";
|
||||
interface = "ens18";
|
||||
};
|
||||
|
||||
adh = {
|
||||
id = 12;
|
||||
description = "Réseau adhérent";
|
||||
ipv4 = {
|
||||
address = mkForce "185.230.78.0";
|
||||
routes = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
via = "185.230.78.12";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
};
|
||||
ipv6 = {
|
||||
address = mkForce "2a0c:700:12::";
|
||||
prefixLength = 48;
|
||||
routes = [
|
||||
{
|
||||
address = "::";
|
||||
via = "2a0c:700:12::ff:fe00:9912";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
adh-adm = {
|
||||
id = 13;
|
||||
description = "Réseau d’administration du réseau adhérent";
|
||||
};
|
||||
|
||||
ens = {
|
||||
id = 2751;
|
||||
description = "Interconnexion avec l’ENS.";
|
||||
ipv4 = {
|
||||
address = mkForce "138.231.136.0";
|
||||
prefixLength = 29;
|
||||
};
|
||||
ipv6 = null;
|
||||
};
|
||||
|
||||
ens-clubs = {
|
||||
id = 2754;
|
||||
description = "Réseau clubs interconnecté avec l’ENS";
|
||||
ipv6 = null;
|
||||
};
|
||||
|
||||
ens-lp = {
|
||||
id = 2756;
|
||||
description = "Réseau imprimante interconnecté avec l’ENS";
|
||||
ipv6 = null;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
ipOpt =
|
||||
v:
|
||||
let
|
||||
maxPrefix = if v == 4 then 32 else 128;
|
||||
in
|
||||
types.submodule {
|
||||
options = {
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
description = "Adresses IPv${v} du réseau";
|
||||
};
|
||||
|
||||
prefixLength = mkOption {
|
||||
type = types.ints.between 0 maxPrefix;
|
||||
default = if v == 4 then 24 else 64;
|
||||
description = "Prefixe du réseau";
|
||||
};
|
||||
|
||||
routes = mkOption {
|
||||
default = [ ];
|
||||
description = "Routes par défaut";
|
||||
example = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
via = "172.16.3.99";
|
||||
prefixLength = 0;
|
||||
}
|
||||
];
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
address = mkOption { type = types.str; };
|
||||
via = mkOption { type = types.str; };
|
||||
prefixLength = mkOption { type = types.ints.between 0 maxPrefix; };
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.crans.vlans = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
id = mkOption {
|
||||
type = types.int;
|
||||
example = "10";
|
||||
description = "Id du VLAN";
|
||||
};
|
||||
|
||||
description = mkOption {
|
||||
type = types.str;
|
||||
description = "Description du VLAN";
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "ens19";
|
||||
description = "Interface par défaut du VLAN";
|
||||
};
|
||||
|
||||
ipv4 = mkOption {
|
||||
type = types.nullOr (ipOpt 4);
|
||||
description = "Réseau IPv4 du VLAN.";
|
||||
};
|
||||
|
||||
ipv6 = mkOption {
|
||||
type = types.nullOr (ipOpt 6);
|
||||
description = "Réseau IPv6 du VLAN.";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
config.crans.vlans = (
|
||||
builtins.mapAttrs (
|
||||
vlan: conf:
|
||||
let
|
||||
vlan = lib.mod conf.id 100;
|
||||
in
|
||||
lib.mkMerge (
|
||||
[ conf ]
|
||||
++ lib.optional ((conf.ipv4 or true) != null) {
|
||||
ipv4.address = mkDefault "172.16.${toString vlan}.0";
|
||||
}
|
||||
++ lib.optional ((conf.ipv6 or true) != null) {
|
||||
ipv6.address = mkDefault "fd00:0:0:${toString vlan}::";
|
||||
}
|
||||
)
|
||||
) vlanConf
|
||||
);
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ in
|
|||
{
|
||||
options = {
|
||||
homeNounou.enable = mkEnableOption "Monter /home_nounou.";
|
||||
homeAdh.enable = mkEnableOption "Monter /home-adh";
|
||||
homeAdh.enable = mkEnableOption "Monter /home-adh.";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ in
|
|||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "Nom de la machine";
|
||||
description = "Nom de la machine.";
|
||||
};
|
||||
|
||||
description = mkOption {
|
||||
type = types.str;
|
||||
description = "Description de la machine";
|
||||
description = "Description de la machine.";
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
|
|
@ -31,13 +31,13 @@ in
|
|||
|
||||
isDebian = mkOption {
|
||||
type = types.bool;
|
||||
description = "Est-ce que c’est une machine sous Débian ?";
|
||||
description = "Est-ce que c’est une machine sous Debian ?";
|
||||
default = false;
|
||||
};
|
||||
|
||||
public-ssh = mkOption {
|
||||
type = types.str;
|
||||
description = "Clé ssh public de la machine";
|
||||
description = "Clé ssh publique de la machine.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
config,
|
||||
crans,
|
||||
infra,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
|
@ -28,7 +28,7 @@ let
|
|||
description = "Port sur le switch ${n}";
|
||||
default = null;
|
||||
})
|
||||
) crans.switchs
|
||||
) infra.switchs
|
||||
);
|
||||
|
||||
routesType = types.listOf (
|
||||
|
|
@ -141,7 +141,7 @@ in
|
|||
}
|
||||
)
|
||||
)
|
||||
) crans.vlans
|
||||
) infra.vlans
|
||||
|
||||
;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ in
|
|||
type = types.path;
|
||||
default = ../../secrets/common/root.age;
|
||||
example = ../../secrets/apprentix/root.age;
|
||||
description = "Fichier chiffré par age contenant le mot de passe root.";
|
||||
description = "Fichier chiffré par agenix contenant le mot de passe root.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue