From 8b5d35eef3fc2d207f2d2cb51b298621e7270ad3 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 22 May 2020 16:34:24 +0530 Subject: [PATCH] fixup nixos modules --- nixos-modules/default.nix | 4 +- nixos-modules/dhall/vbox-guest.dhall | 11 ++ nixos-modules/dhall/vbox-host.dhall | 171 ++++++++++++++++++++------- 3 files changed, 143 insertions(+), 43 deletions(-) diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index 08fa9a9..ac303b6 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -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 ]; diff --git a/nixos-modules/dhall/vbox-guest.dhall b/nixos-modules/dhall/vbox-guest.dhall index 96f7e9b..0ec7a35 100644 --- a/nixos-modules/dhall/vbox-guest.dhall +++ b/nixos-modules/dhall/vbox-guest.dhall @@ -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" } diff --git a/nixos-modules/dhall/vbox-host.dhall b/nixos-modules/dhall/vbox-host.dhall index d6f671c..02001cb 100644 --- a/nixos-modules/dhall/vbox-host.dhall +++ b/nixos-modules/dhall/vbox-host.dhall @@ -78,52 +78,62 @@ let rootInit = , config = Init.Config::{ , attributes = toMap { system = "yes" } , content = - [ XML.text - '' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - '' - ] + let PciPolicy/Type = + { labelSuffix : Text, pciClass : Text } + + in [ XML.text + '' + + + + + + + + + + + + + + + '' + ] + # 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") + ] + } } }