Netconf-Module/junos/default.nix
2024-08-31 22:37:30 +02:00

44 lines
845 B
Nix

{
name,
lib,
config,
...
}:
with lib;
let
mandatory.options = {
supportPoE = mkOption {
type = types.bool;
};
};
in
{
imports = [
./protocols.nix
./interfaces.nix
./vlans.nix
./poe.nix
];
options = {
netconf.xmls.configuration = mkOption {
type = types.str;
readOnly = true;
};
netconf.mandatoryInterfaces = mkOption { type = types.attrsOf (types.submodule mandatory); };
};
config.interfaces =
let
mkIntf = _: _: {
enable = mkDefault false;
};
in
mapAttrs mkIntf config.netconf.mandatoryInterfaces;
config.netconf.xmls.configuration = ''
<configuration>
${config.netconf.xmls.interfaces}
${config.netconf.xmls.protocols}
${config.netconf.xmls.vlans}
${config.netconf.xmls.poe}
</configuration>
'';
}