nix/profiles/vogon/guest.nix

41 lines
No EOL
999 B
Nix

{ config, lib, ... }:
let
inherit (lib) mkOption types;
cfg = config.vogon;
in
{
options.vogon = {
networking = {
last-octet = mkOption {
type = types.listOf (types.ints.between 161 174);
description = ''
Liste des derniers octets de l'IPv4 de la machine.
'';
example = [ 163 165 ];
};
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";
};
networks."10-wan" = {
matchConfig.Name = "wan";
address = map (octet: "193.54.193.${toString octet}/28") cfg.networking.last-octet;
routes = [ { Gateway = "193.54.193.174"; } ];
linkConfig.RequiredForOnline = "routable";
};
};
}