diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index 02dbaa4..b752861 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -111,6 +111,7 @@ "log_core" "nit_fb" "nitpicker" + "nic_router" "part_block" "platform_drv" "posix" diff --git a/nixos-modules/dhall/root.dhall b/nixos-modules/dhall/root.dhall index 548b694..81d9f07 100644 --- a/nixos-modules/dhall/root.dhall +++ b/nixos-modules/dhall/root.dhall @@ -660,6 +660,75 @@ let rootInit = (Some "nic_drv") ] } + , nic_router = + Child.flat + Child.Attributes::{ + , binary = "nic_router" + , config = Init.Config::{ + , content = + [ XML.leaf + { name = "uplink" + , attributes = toMap { domain = "uplink" } + } + , XML.element + { name = "domain" + , attributes = toMap { name = "uplink" } + , content = + [ XML.leaf + { name = "nat" + , attributes = toMap + { domain = "default" + , tcp-ports = "1024" + , udp-ports = "1024" + , icmp-ids = "1024" + } + } + ] + } + , XML.element + { name = "domain" + , attributes = toMap + { name = "default", interface = "10.0.1.1/24" } + , content = + [ XML.leaf + { name = "dhcp-server" + , attributes = toMap + { ip_first = "10.0.1.2" + , ip_last = "10.0.1.200" + , dns_server_from = "uplink" + } + } + ] + # Prelude.List.map + Text + XML.Type + ( λ(proto : Text) + → XML.element + { name = proto + , attributes = toMap + { dst = "0.0.0.0/0" + , domain = "uplink" + } + , content = + [ XML.leaf + { name = "permit-any" + , attributes = toMap + { domain = "uplink" } + } + ] + } + ) + [ "tcp", "udp", "icmp" ] + } + ] + , defaultPolicy = Some DefaultPolicy::{ + , attributes = toMap { domain = "default" } + } + } + , provides = [ "Nic" ] + , resources = Init.Resources::{ ram = Genode.units.MiB 8 } + , routes = [ ServiceRoute.child "Nic" "nic_drv" ] + } , init = Init.toChild Init::{ children = params.guests } @@ -701,7 +770,7 @@ let rootInit = } } , ServiceRoute.child "File_system" "chroot" - , ServiceRoute.child "Nic" "nic_drv" + , ServiceRoute.child "Nic" "nic_router" , ServiceRoute.child "Rtc" "rtc" , ServiceRoute.parentLabel "ROM"