mirror of https://gitlab.crans.org/nounous/nixos
utiliser le vrai id de la vm dans la config
parent
eb86f85eb8
commit
b7db94b1ec
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "50";
|
||||
id = 150;
|
||||
srvNat.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "63";
|
||||
id = 163;
|
||||
srv = {
|
||||
enable = true;
|
||||
ipv4 = "185.230.79.15";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "40";
|
||||
id = 140;
|
||||
srvNat.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "41";
|
||||
id = 141;
|
||||
srv = {
|
||||
enable = true;
|
||||
ipv4 = "185.230.79.5";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
crans = {
|
||||
enable = true;
|
||||
networking = {
|
||||
id = "46";
|
||||
id = 146;
|
||||
srvNat = {
|
||||
enable = true;
|
||||
interface = "ens20";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "18";
|
||||
id = 118;
|
||||
srvNat.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "39";
|
||||
id = 139;
|
||||
srvNat.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "51";
|
||||
id = 151;
|
||||
srvNat.enable = true;
|
||||
srv = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "35";
|
||||
id = 135;
|
||||
srvNat = {
|
||||
enable = true;
|
||||
interface = "ens19";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
enable = true;
|
||||
|
||||
networking = {
|
||||
id = "59";
|
||||
id = 159;
|
||||
srvNat.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,21 @@ let
|
|||
mkOption
|
||||
types
|
||||
;
|
||||
in
|
||||
|
||||
idString = toString cfg.id;
|
||||
hostId = lib.mod cfg.id 100;
|
||||
hostIdString = lib.fixedWidthString 2 "0" (toString hostId);
|
||||
isVm = cfg.id >= 100;
|
||||
isVmString = toString isVm;
|
||||
in
|
||||
{
|
||||
options.crans.networking = {
|
||||
enable = mkEnableOption "Configuration réseaux commune à toutes les machines du Crans.";
|
||||
|
||||
id = mkOption {
|
||||
type = types.str;
|
||||
example = "35";
|
||||
description = "Le numéro de la VM dans Proxmox (sans le `1` devant).";
|
||||
type = types.int;
|
||||
example = 135;
|
||||
description = "Le numéro de la VM dans Proxmox.";
|
||||
};
|
||||
|
||||
adm = {
|
||||
|
|
@ -97,14 +102,14 @@ in
|
|||
adm = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "172.16.10.1${cfg.id}";
|
||||
address = "172.16.10.${idString}";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
|
||||
ipv6.addresses = [
|
||||
{
|
||||
address = "fd00::10:0:ff:fe01:${cfg.id}10";
|
||||
address = "fd00::10:0:ff:fe0${isVmString}:${hostIdString}10";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
|
|
@ -130,7 +135,7 @@ in
|
|||
ipv6 = {
|
||||
addresses = [
|
||||
{
|
||||
address = "2a0c:700:2::ff:fe01:${cfg.id}02";
|
||||
address = "2a0c:700:2::ff:fe0${isVmString}:${hostIdString}02";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
|
|
@ -149,7 +154,7 @@ in
|
|||
ipv4 = {
|
||||
addresses = [
|
||||
{
|
||||
address = "172.16.3.1${cfg.id}";
|
||||
address = "172.16.3.${idString}";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
|
|
@ -165,7 +170,7 @@ in
|
|||
ipv6 = {
|
||||
addresses = [
|
||||
{
|
||||
address = "2a0c:700:3::ff:fe01:${cfg.id}03";
|
||||
address = "2a0c:700:3::ff:fe0${isVmString}:${hostIdString}03";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
|
|
@ -183,14 +188,14 @@ in
|
|||
san = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "172.16.4.1${cfg.id}";
|
||||
address = "172.16.4.${idString}";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
|
||||
ipv6.addresses = [
|
||||
{
|
||||
address = "fd00::4:0:ff:fe01:${cfg.id}04";
|
||||
address = "fd00::4:0:ff:fe0${isVmString}:${hostIdString}04";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue