Netconf-Module/junos/default.nix

36 lines
744 B
Nix

{
name,
lib,
config,
...
}:
with lib;
{
imports = [
./protocols.nix
./interfaces.nix
./vlans.nix
];
options = {
netconf.xmls.configuration = mkOption {
type = types.str;
readOnly = true;
};
netconf.mandatoryInterfaces = mkOption { type = types.listOf types.str; };
};
config.interfaces =
let
mkIntf = name: {
inherit name;
value.enable = mkDefault false;
};
in
listToAttrs (map mkIntf config.netconf.mandatoryInterfaces);
config.netconf.xmls.configuration = ''
<configuration>
${config.netconf.xmls.interfaces}
${config.netconf.xmls.protocols}
${config.netconf.xmls.vlans}
</configuration>
'';
}