2
0
Fork 0
genodepkgs/nixos-modules/root-config.dhall

71 lines
2.2 KiB
Plaintext

let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Init = Genode.Init
let Child = Init.Child
let nicChild
: Text → Init.Children.Entry
= λ(tapDevice : Text)
→ { mapKey = tapDevice
, mapValue =
Child.flat
Child.Attributes::{
, binary = "linux_nic_drv"
, config = Init.Config::{ attributes = toMap { tap = tapDevice } }
, ld = False
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, provides = [ "Nic" ]
}
}
let nicChildren = Prelude.List.map Text Init.Children.Entry nicChild
let init =
λ(params : { guest : Init.Type, nics : List Text })
→ Init::{
, routes = [ Init.ServiceRoute.child "Timer" "timer_drv" ]
, children =
nicChildren params.nics
# toMap
{ timer_drv =
Child.flat
Child.Attributes::{
, binary = "timer_drv"
, provides = [ "Timer" ]
}
, init =
Init.toChild
params.guest
Init.Attributes::{
, exitPropagate = True
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
( λ(tapDevice : Text)
→ { service =
{ name = "Nic"
, label = Init.LabelSelector.last tapDevice
}
, route =
Init.Route.Type.Child
{ name = tapDevice
, label = None Text
, diag = None Bool
}
}
)
params.nics
}
}
, verbose = True
}
in init