Netconf-Module/junos/default.nix

45 lines
845 B
Nix
Raw Normal View History

2024-04-30 20:08:07 +02:00
{
name,
lib,
config,
...
}:
with lib;
2024-08-31 22:37:30 +02:00
let
mandatory.options = {
supportPoE = mkOption {
type = types.bool;
};
};
in
2024-04-30 20:08:07 +02:00
{
imports = [
./protocols.nix
./interfaces.nix
./vlans.nix
2024-08-31 18:54:15 +02:00
./poe.nix
2024-04-30 20:08:07 +02:00
];
options = {
netconf.xmls.configuration = mkOption {
type = types.str;
readOnly = true;
};
2024-08-31 22:37:30 +02:00
netconf.mandatoryInterfaces = mkOption { type = types.attrsOf (types.submodule mandatory); };
2024-04-30 20:08:07 +02:00
};
config.interfaces =
let
2024-08-31 22:37:30 +02:00
mkIntf = _: _: {
enable = mkDefault false;
2024-04-30 20:08:07 +02:00
};
in
2024-08-31 22:37:30 +02:00
mapAttrs mkIntf config.netconf.mandatoryInterfaces;
2024-04-30 20:08:07 +02:00
config.netconf.xmls.configuration = ''
2024-05-22 13:33:28 +02:00
<configuration>
${config.netconf.xmls.interfaces}
${config.netconf.xmls.protocols}
${config.netconf.xmls.vlans}
2024-08-31 18:54:15 +02:00
${config.netconf.xmls.poe}
2024-05-22 13:33:28 +02:00
</configuration>
'';
2024-04-30 20:08:07 +02:00
}