47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
{ 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 = [
|
|
{
|
|
Gateway = "172.17.11.254";
|
|
}
|
|
];
|
|
linkConfig.RequiredForOnline = "routable";
|
|
};
|
|
};
|
|
}
|