38 lines
767 B
Nix
38 lines
767 B
Nix
{
|
|
name,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
imports = [
|
|
./protocols.nix
|
|
./interfaces.nix
|
|
./vlans.nix
|
|
./poe.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}
|
|
${config.netconf.xmls.poe}
|
|
</configuration>
|
|
'';
|
|
}
|