profiles/glucagon: init
Factor out all the networking configuration specific to Glucagon. Signed-off-by: Ryan Lahfa <federez-infra@lahfa.xyz>
This commit is contained in:
parent
3ed9d02acb
commit
76218cc7cb
2 changed files with 61 additions and 53 deletions
65
hive.nix
65
hive.nix
|
@ -14,6 +14,7 @@ in
|
||||||
defaults = { pkgs, ... }: {
|
defaults = { pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./profiles/sysadmin.nix
|
./profiles/sysadmin.nix
|
||||||
|
./profiles/glucagon.nix
|
||||||
"${src.agenix}/modules/age.nix"
|
"${src.agenix}/modules/age.nix"
|
||||||
(disko.config diskConfig)
|
(disko.config diskConfig)
|
||||||
];
|
];
|
||||||
|
@ -35,27 +36,13 @@ in
|
||||||
estragon = { name, nodes, ... }: {
|
estragon = { name, nodes, ... }: {
|
||||||
deployment.tags = [ "matrix" ];
|
deployment.tags = [ "matrix" ];
|
||||||
deployment.targetHost = "estragon.federez.net";
|
deployment.targetHost = "estragon.federez.net";
|
||||||
systemd.network.links."10-wan" = {
|
|
||||||
matchConfig.MACAddress = "BC:24:11:5C:A4:5A";
|
|
||||||
linkConfig.Name = "wan";
|
|
||||||
};
|
|
||||||
systemd.network.networks."10-wan" = {
|
|
||||||
matchConfig.Name = "wan";
|
|
||||||
address = [
|
|
||||||
"172.17.8.227/22"
|
|
||||||
];
|
|
||||||
routes = [
|
|
||||||
{
|
|
||||||
routeConfig = {
|
|
||||||
Gateway = "172.17.11.254";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
linkConfig.RequiredForOnline = "routable";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
|
|
||||||
|
glucagon.networking = {
|
||||||
|
nibble = 227;
|
||||||
|
wan-mac = "BC:24:11:5C:A4:5A";
|
||||||
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./profiles/vm.nix
|
./profiles/vm.nix
|
||||||
./profiles/matrix-server.nix
|
./profiles/matrix-server.nix
|
||||||
|
@ -70,23 +57,9 @@ in
|
||||||
deployment.targetHost = "wagon.federez.net";
|
deployment.targetHost = "wagon.federez.net";
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
|
|
||||||
systemd.network.links."10-wan" = {
|
glucagon.networking = {
|
||||||
matchConfig.MACAddress = "BC:24:11:EA:6C:0B";
|
nibble = 228;
|
||||||
linkConfig.Name = "wan";
|
wan-mac = "BC:24:11:EA:6C:0B";
|
||||||
};
|
|
||||||
systemd.network.networks."10-wan" = {
|
|
||||||
matchConfig.Name = "wan";
|
|
||||||
address = [
|
|
||||||
"172.17.8.228/22"
|
|
||||||
];
|
|
||||||
routes = [
|
|
||||||
{
|
|
||||||
routeConfig = {
|
|
||||||
Gateway = "172.17.11.254";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
linkConfig.RequiredForOnline = "routable";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -100,23 +73,9 @@ in
|
||||||
deployment.targetHost = "lagon.federez.net";
|
deployment.targetHost = "lagon.federez.net";
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
|
|
||||||
systemd.network.links."10-wan" = {
|
glucagon.networking = {
|
||||||
matchConfig.MACAddress = "BC:24:11:7F:19:60";
|
nibble = 229;
|
||||||
linkConfig.Name = "wan";
|
wan-mac = "BC:24:11:7F:19:60";
|
||||||
};
|
|
||||||
systemd.network.networks."10-wan" = {
|
|
||||||
matchConfig.Name = "wan";
|
|
||||||
address = [
|
|
||||||
"172.17.8.229/22"
|
|
||||||
];
|
|
||||||
routes = [
|
|
||||||
{
|
|
||||||
routeConfig = {
|
|
||||||
Gateway = "172.17.11.254";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
linkConfig.RequiredForOnline = "routable";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
|
49
profiles/glucagon.nix
Normal file
49
profiles/glucagon.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption types;
|
||||||
|
cfg = config.glucagon;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.glucagon = {
|
||||||
|
networking = {
|
||||||
|
nibble = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
description = '''
|
||||||
|
Derniers 8 bits de l'IPv4 de la machine.
|
||||||
|
Cela configurera automatiquement l'IPv4 interne de NAT.
|
||||||
|
'';
|
||||||
|
example = 230;
|
||||||
|
};
|
||||||
|
|
||||||
|
wan-mac = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = '''
|
||||||
|
Adresse MAC de l'interface réseau WAN
|
||||||
|
qui portera l'IPv4 interne.
|
||||||
|
'';
|
||||||
|
example = "BC:24:11:B7:AE:80";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
systemd.network.links."10-wan" = {
|
||||||
|
matchConfig.MACAddress = cfg.networking.wan-mac;
|
||||||
|
linkConfig.Name = "wan";
|
||||||
|
};
|
||||||
|
systemd.network.networks."10-wan" = {
|
||||||
|
matchConfig.Name = "wan";
|
||||||
|
address = [
|
||||||
|
"172.17.8.${toString cfg.networking.nibble}/22"
|
||||||
|
];
|
||||||
|
routes = [
|
||||||
|
{
|
||||||
|
routeConfig = {
|
||||||
|
Gateway = "172.17.11.254";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue