2
0
Fork 0

fixup nixos modules

This commit is contained in:
Ehmry - 2020-05-22 16:34:24 +05:30
parent 8858917eac
commit 8b5d35eef3
3 changed files with 143 additions and 43 deletions

View File

@ -52,6 +52,8 @@ let
imageInputs = map pkgs'.genodeSources.depot [
"acpi_drv"
"ahci_drv"
"chroot"
"cached_fs_rom"
"init"
"input_filter"
"ipxe_nic_drv"
@ -71,7 +73,7 @@ let
"terminal"
"terminal_log"
"vbox5"
"vesa_drv"
"intel_fb_drv"
"vfs"
"vfs_ttf"
] ++ [ pkgs'.base-nova pkgs'.block_router ];

View File

@ -125,6 +125,17 @@ let toVbox =
, attributes = toMap { name = "dev" }
, content = [ tag "log", tag "rtc" ]
}
, XML.element
{ name = "dir"
, attributes = toMap { name = "nix" }
, content =
[ XML.leaf
{ name = "fs"
, attributes = toMap
{ writeable = "no", label = "nix" }
}
]
}
, XML.leaf
{ name = "fs"
, attributes = toMap { writeable = "yes" }

View File

@ -78,52 +78,62 @@ let rootInit =
, config = Init.Config::{
, attributes = toMap { system = "yes" }
, content =
[ XML.text
''
<report pci="yes"/>
<policy label_suffix="ps2_drv">
<device name="PS2"/>
</policy>
<policy label_suffix="vesa_fb_drv">
<pci class="VGA"/>
</policy>
<policy label_suffix="ahci_drv">
<pci class="AHCI"/>
</policy>
<policy label_suffix="nvme_drv">
<pci class="NVME"/>
</policy>
<policy label_suffix="usb_drv">
<pci class="USB"/>
</policy>
<policy label_suffix="intel_fb_drv">
<pci class="VGA"/>
<pci bus="0" device="0" function="0"/>
<pci class="ISABRIDGE"/>
</policy>
<policy label_suffix="wifi_drv">
<pci class="WIFI"/>
</policy>
<policy label_suffix="nic_drv">
<pci class="ETHERNET"/>
</policy>
<policy label_suffix="audio">
<pci class="AUDIO"/>
<pci class="HDAUDIO"/>
</policy>
<policy label="acpica"/>
''
]
let PciPolicy/Type =
{ labelSuffix : Text, pciClass : Text }
in [ XML.text
''
<report pci="yes"/>
<policy label_suffix="ps2_drv">
<device name="PS2"/>
</policy>
<policy label_suffix="intel_fb_drv">
<pci class="VGA"/>
<pci bus="0" device="0" function="0"/>
<pci class="ISABRIDGE"/>
</policy>
<policy label_suffix="audio">
<pci class="AUDIO"/>
<pci class="HDAUDIO"/>
</policy>
<policy label="acpica"/>
''
]
# Prelude.List.map
PciPolicy/Type
XML.Type
( λ(policy : PciPolicy/Type)
→ XML.element
{ name = "policy"
, attributes = toMap
{ label_suffix = policy.labelSuffix }
, content =
[ XML.leaf
{ name = "pci"
, attributes = toMap
{ class = policy.pciClass }
}
]
}
)
[ { labelSuffix = "ahci_drv"
, pciClass = "AHCI"
}
, { labelSuffix = "nic_drv"
, pciClass = "ETHERNET"
}
, { labelSuffix = "usb_drv", pciClass = "USB" }
]
}
}
, framebuffer =
Child.flat
Child.Attributes::{
, binary = "vesa_fb_drv"
, binary = "intel_fb_drv"
, provides = [ "Framebuffer" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 16
, ram = Genode.units.MiB 48
}
, routes =
[ ServiceRoute.parent "IO_MEM"
@ -132,7 +142,7 @@ let rootInit =
"Platform"
"platform_drv"
(None Text)
(Some "vesa_fb_drv")
(Some "intel_fb_drv")
]
}
, input_filter =
@ -462,8 +472,28 @@ let rootInit =
]
}
, XML.leaf
{ name = "default-policy"
, attributes = toMap { root = "/", writeable = "yes" }
{ name = "policy"
, attributes = toMap
{ label_prefix = "chroot"
, root = "/"
, writeable = "yes"
}
}
, XML.leaf
{ name = "policy"
, attributes = toMap
{ label_last = "nix"
, root = "/nix"
, writeable = "no"
}
}
, XML.leaf
{ name = "policy"
, attributes = toMap
{ label = "store_rom"
, root = "/nix/store"
, writeable = "no"
}
}
]
}
@ -474,6 +504,25 @@ let rootInit =
}
, routes = [ ServiceRoute.child "Block" "block_router" ]
}
, store_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Init.Resources::{
, ram =
let TODO_paramater = Genode.units.MiB 64
in TODO_paramater
}
, routes =
[ Init.ServiceRoute.childLabel
"File_system"
"file_system"
(None Text)
(Some "store_rom")
]
}
, nic_drv =
Child.flat
Child.Attributes::{
@ -491,8 +540,46 @@ let rootInit =
(Some "nic_drv")
]
}
, chroot =
Child.flat
Child.Attributes::{
, binary = "chroot"
, config = Init.Config::{
, content =
[ XML.leaf
{ name = "default-policy"
, attributes = toMap { writeable = "yes" }
}
]
}
, provides = [ "File_system" ]
, routes = [ ServiceRoute.child "File_system" "file_system" ]
}
, guests =
Init.toChild Init::{ children = guests } Init.Attributes::{=}
Init.toChild
Init::{ children = guests, verbose = True }
Init.Attributes::{
, routes =
[ ServiceRoute.parent "VM"
, ServiceRoute.parent "Nitpicker"
, { service =
{ name = "File_system"
, label = Init.LabelSelector.Type.Last "nix"
}
, route =
Init.Route.Type.Child
{ name = "file_system", label = Some "nix" }
}
, ServiceRoute.child "File_system" "chroot"
, ServiceRoute.child "Nic" "nic_drv"
, ServiceRoute.child "Rtc" "rtc"
, ServiceRoute.child "Report" "pointer"
, ServiceRoute.parentLabel
"ROM"
(Some "platform_info")
(Some "platform_info")
]
}
}
}