{ lib, config, ... }: with lib; let interface-module = { name, config, ... }: { options = { enable = mkEnableOption "the PoE for this interface"; xml = mkOption { type = types.str; visible = false; readOnly = true; }; }; config.xml = '' ${name}${optionalString (!config.enable) ""} ''; }; in { options = { poe.interfaces = mkOption { type = types.attrsOf (types.submodule interface-module); default = { }; description = '' PoE configuration of interfaces. ''; }; netconf.xmls.poe = mkOption { type = types.str; visible = false; readOnly = true; }; }; config.netconf.xmls.poe = '' ${ builtins.concatStringsSep "" (attrsets.mapAttrsToList (_: intf: intf.xml) config.poe.interfaces) } ''; }