{ config, pkgs, lib, ... }: with lib; { options.genode = { hardware = { nic = mkOption { default = { }; example = { eth0.driver = "virtio"; }; description = "The configuration for each Nic service."; type = let nicOptions = { name, ... }: { name = mkOption { example = "eth0"; type = types.str; description = "Name of the Nic service."; }; driver = mkOption { type = types.enum [ "ipxe" "virtio" ]; }; ipStack = mkOption { type = types.enum [ "lwip" "lxip" ]; default = "lwip"; }; }; in types.attrsOf (types.submodule nicOptions); }; }; }; config = { genode.init.children = let drivers = mapAttrsToList (name: interface: { name = name + "-nic"; value = { }; }) config.networking.interfaces; sockets = mapAttrsToList (name: interface: { name = name + "-sockets"; value = { }; }) config.networking.interfaces; in builtins.listToAttrs (drivers ++ sockets); }; }