diff --git a/nixos-modules/buildBootDescription.nix b/nixos-modules/buildBootDescription.nix
index fc2323a..4e818dc 100644
--- a/nixos-modules/buildBootDescription.nix
+++ b/nixos-modules/buildBootDescription.nix
@@ -24,8 +24,12 @@ let
matches = let
f = binary: {
name = binary;
- value = let maybeNull = map (drv: toPath "${drv}/${binary}") imageInputs;
- in filter pathExists maybeNull;
+ value = let
+ f = if lib.hasPrefix "lib" binary && lib.hasSuffix ".so" binary then
+ drv: toPath "${drv.lib or drv}/lib/${binary}"
+ else
+ drv: toPath "${drv}/${binary}";
+ in filter pathExists (map f imageInputs);
};
in map f binaries;
diff --git a/nixos-modules/partition-type b/nixos-modules/dhall/partition-type
similarity index 100%
rename from nixos-modules/partition-type
rename to nixos-modules/dhall/partition-type
diff --git a/nixos-modules/vbox-host.dhall b/nixos-modules/dhall/vbox-host.dhall
similarity index 79%
rename from nixos-modules/vbox-host.dhall
rename to nixos-modules/dhall/vbox-host.dhall
index de23307..069e382 100644
--- a/nixos-modules/vbox-host.dhall
+++ b/nixos-modules/dhall/vbox-host.dhall
@@ -18,23 +18,13 @@ let label =
λ(label : Text)
→ { local = label, route = label } : Child.Attributes.Label
-let inlineConfig =
- λ(name : Text)
- → λ(config : Init.Config.Type)
- → XML.element
- { name = "inline"
- , attributes = toMap { name = name }
- , content =
- Prelude.Optional.toList XML.Type (Init.Config.toXML config)
- }
-
let Vfs/inline =
λ(name : Text)
→ λ(body : Text)
→ XML.element
{ name = "inline"
, attributes = XML.emptyAttributes
- , content = XML.Text body
+ , content = [ XML.text body ]
}
let rootInit =
@@ -62,7 +52,8 @@ let rootInit =
-
+
@@ -210,62 +201,83 @@ let rootInit =
Child.flat
Child.Attributes::{
, binary = "input_filter"
- , config = Init.Config::{
- , content =
- [ XML.leaf
- { name = "input"
- , attributes = toMap { label = "ps2" }
- }
- , XML.element
- { name = "output"
- , attributes = XML.emptyAttributes
+ , config =
+ let key =
+ λ(name : Text)
+ → XML.leaf
+ { name = "key"
+ , attributes = toMap { name = name }
+ }
+
+ let remap =
+ λ(name : Text)
+ → λ(to : Text)
+ → XML.leaf
+ { name = "key"
+ , attributes = toMap
+ { name = name, to = to }
+ }
+
+ in Init.Config::{
, content =
- [ XML.element
- { name = "chargen"
+ [ XML.leaf
+ { name = "input"
+ , attributes = toMap { label = "ps2" }
+ }
+ , XML.element
+ { name = "output"
, attributes = XML.emptyAttributes
, content =
- [ XML.element
- { name = "remap"
- , attributes = XML.emptyAttributes
- , content =
- [ remap
- "KEY_LEFTMETA"
- "KEY_SCREEN"
- , XML.leaf
- { name = "input"
- , attributes = toMap
- { name = "ps2" }
- }
- ]
- }
- , XML.element
- { name = "mod1"
- , attributes = XML.emptyAttributes
- , content =
- [ key "KEY_LEFTSHIFT"
- , key "KEY_RIGHTSHIFT"
- ]
- }
- , XML.element
- { name = "mod2"
- , attributes = XML.emptyAttributes
- , content =
- [ key "KEY_LEFTCTRL"
- , key "KEY_RIGHTCTRL"
- ]
- }
- , XML.element
- { name = "mod3"
- , attributes = XML.emptyAttributes
- , content = [ key "KEY_RIGHTALT" ]
- }
- ]
- # ./workman.map.dhall
+ [ XML.element
+ { name = "chargen"
+ , attributes = XML.emptyAttributes
+ , content =
+ [ XML.element
+ { name = "remap"
+ , attributes =
+ XML.emptyAttributes
+ , content =
+ [ remap
+ "KEY_LEFTMETA"
+ "KEY_SCREEN"
+ , XML.leaf
+ { name = "input"
+ , attributes = toMap
+ { name = "ps2" }
+ }
+ ]
+ }
+ , XML.element
+ { name = "mod1"
+ , attributes =
+ XML.emptyAttributes
+ , content =
+ [ key "KEY_LEFTSHIFT"
+ , key "KEY_RIGHTSHIFT"
+ ]
+ }
+ , XML.element
+ { name = "mod2"
+ , attributes =
+ XML.emptyAttributes
+ , content =
+ [ key "KEY_LEFTCTRL"
+ , key "KEY_RIGHTCTRL"
+ ]
+ }
+ , XML.element
+ { name = "mod3"
+ , attributes =
+ XML.emptyAttributes
+ , content =
+ [ key "KEY_RIGHTALT" ]
+ }
+ ]
+ }
+ ]
}
]
}
- ]
- }
, provides = [ "Input" ]
, routes =
[ ServiceRoute.parentLabel
@@ -319,12 +331,6 @@ let rootInit =
, binary = "pointer"
, routes = [ ServiceRoute.child "Nitpicker" "nitpicker" ]
}
- , log_console =
- Init.toChild
- ./log-console.dhall
- Init.Attributes::{
- , routes = [ ServiceRoute.child "Nitpicker" "nitpicker" ]
- }
, block =
Child.flat
Child.Attributes::{
@@ -344,7 +350,7 @@ let rootInit =
, ram = Genode.units.MiB 10
}
, routes =
- [ ServiceRoute.child
+ [ ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
@@ -481,20 +487,22 @@ let rootInit =
, attributes = XML.emptyAttributes
}
- in [ XML.element
- { name = "dev"
- , attributes = XML.emptyAttributes
- , content = [ tag log, tag rtc ]
+ in [ Vfs/inline "nixos.vbox" vboxConfig
+ , XML.element
+ { name = "dir"
+ , attributes = toMap { name = "dev" }
+ , content = [ tag "log", tag "rtc" ]
}
- , Vfs/inline "nixos.vbox" vboxConfig
- , tag "file_system"
+ , tag "fs"
]
}
]
}
, resources = Resources::{
, caps = 1024
- , ram = Genode.units.MiB 256
+ , ram =
+ Genode.units.MiB 64
+ + Genode.units.MiB params.memorySize
}
, routes =
[ ServiceRoute.parent "VM"
diff --git a/nixos-modules/vbox.nix b/nixos-modules/vbox.nix
index fb7b268..5fa50ea 100644
--- a/nixos-modules/vbox.nix
+++ b/nixos-modules/vbox.nix
@@ -1,5 +1,7 @@
{ self }:
-let lib' = self.lib.x86_64-linux-x86_64-genode;
+let
+ lib' = self.lib.x86_64-linux-x86_64-genode;
+ pkgs' = self.packages.x86_64-linux-x86_64-genode;
in { config, lib, pkgs, ... }:
let
@@ -12,7 +14,7 @@ let
vdiUuid=$(${pkgs.virtualbox}/bin/VBoxManage showmediuminfo ${config.system.build.virtualBoxVDI}/nixos.vdi | awk '/^UUID:/ {print $2}')
dhall > $out << EOD
{ vdiFilename = "nixos.vdi"
- , vidUuid = "$vdiUuid"
+ , vdiUuid = "$vdiUuid"
, memorySize = ${toString config.virtualbox.memorySize}
, vmName = "${config.virtualbox.vmName}"
}
@@ -21,34 +23,42 @@ let
bootDescription = buildBootDescription {
name = "boot-description";
- initConfig = "./vbox-host.dhall ${genodeParams}";
- imageInputs = (map pkgs.genodeSources.depot [
+ initConfig = "${./dhall}/vbox-host.dhall ${genodeParams}";
+ imageInputs = map pkgs'.genodeSources.depot [
"acpi_drv"
"ahci_drv"
"init"
"input_filter"
"libc"
+ "libiconv"
"nitpicker"
"part_block"
"platform_drv"
"ps2_drv"
"report_rom"
"rtc_drv"
+ "rump"
+ "stdcxx"
+ "vbox5"
"vesa_drv"
"vfs"
- ]) ++ (map pkgs.genodeSources.make [ "drivers/input/dummy" ])
- ++ [ pkgs.base-nova pkgs.block_router ];
+ ] ++ [ pkgs'.base-nova pkgs'.block_router ];
extraBinaries = [
"ld.lib.so"
- "libc.lib.so"
- "libm.lib.so"
- "rump.lib.so"
- "rump_fs.lib.so"
- "vfs_rump.lib.so"
+ "libc.so"
+ "libc_pipe.so"
+ "libiconv.so"
+ "libm.so"
+ "libqemu-usb.so"
+ "librump.so"
+ "librump_fs.so"
+ "libstdcxx.so"
+ "libvfs.so"
+ "libvfs_rump.so"
];
};
- novaImage = lib'.novaImage "stage0" { } bootDescription;
+ firmware = lib'.novaImage "stage0" { } bootDescription;
# add system.build.virtualBoxVDI/nixos.vdi to disk image
@@ -64,7 +74,7 @@ let
cat zero.raw fs.raw zero.raw > gpt.raw
sgdisk gpt.raw --new=partnum 1:34:-34 \
- --typecode=1:${import ./partition-type} \
+ --typecode=1:${import ./dhall/partition-type} \
--change-name=1:genode
mkdir -p $out
@@ -72,5 +82,21 @@ let
'';
in {
- system.build.genodeDiskImage = novaImage;
+ system.build.genodeDiskImage =
+ pkgs.runCommand "nixos-vm" { preferLocalBuild = true; } ''
+ mkdir -p $out/bin
+ ln -s ${
+ pkgs.writeScript "run-nixos-vm" ''
+ #! ${pkgs.runtimeShell}
+ ${pkgs.vmTools.qemu}/bin/qemu-system-x86_64 \
+ -machine q35 \
+ -cpu phenom \
+ -m 512 \
+ -serial mon:stdio \
+ -kernel "${pkgs'.bender}" \
+ -initrd "${pkgs'.NOVA}/hypervisor-x86_64 arg=iommu novpid serial logmem,${firmware}" \
+ $@
+ ''
+ } $out/bin/run-genode-vm
+ '';
}
diff --git a/nixos-modules/workman.map.dhall b/nixos-modules/workman.map.dhall
deleted file mode 100644
index 90885a1..0000000
--- a/nixos-modules/workman.map.dhall
+++ /dev/null
@@ -1,245 +0,0 @@
-let Genode = ./Genode.dhall
-
-let Prelude = Genode.Prelude
-
-let XML = Prelude.XML
-
-let Key = < Ascii : Natural | Char : Text | Code : Natural > : Type
-
-let Map =
- { Type =
- { keys : Prelude.Map.Type Text Key
- , mod1 : Bool
- , mod2 : Bool
- , mod3 : Bool
- , mod4 : Bool
- }
- , default = { mod1 = False, mod2 = False, mod3 = False, mod4 = False }
- }
-
-let boolToAttr = λ(_ : Bool) → if _ then "yes" else "no"
-
-let keyToXML =
- λ(x : Prelude.Map.Entry Text Key)
- → XML.leaf
- { name = "key"
- , attributes =
- [ merge
- { Ascii =
- λ(_ : Natural)
- → { mapKey = "ascii", mapValue = Prelude.Natural.show _ }
- , Char = λ(_ : Text) → { mapKey = "char", mapValue = _ }
- , Code =
- λ(_ : Natural)
- → { mapKey = "code", mapValue = Prelude.Natural.show _ }
- }
- x.mapValue
- , { mapKey = "name", mapValue = x.mapKey }
- ]
- }
-
-let mapToXML =
- λ(map : Map.Type)
- → XML.element
- { name = "map"
- , attributes = toMap
- { mod1 = boolToAttr map.mod1
- , mod2 = boolToAttr map.mod2
- , mod3 = boolToAttr map.mod3
- , mod4 = boolToAttr map.mod4
- }
- , content =
- Prelude.List.map
- (Prelude.Map.Entry Text Key)
- XML.Type
- keyToXML
- map.keys
- }
-
-let workman =
- [ Map::{
- , keys = toMap
- { KEY_ESC = Key.Ascii 27
- , KEY_1 = Key.Char "1"
- , KEY_2 = Key.Char "2"
- , KEY_3 = Key.Char "3"
- , KEY_4 = Key.Char "4"
- , KEY_5 = Key.Char "5"
- , KEY_6 = Key.Char "6"
- , KEY_7 = Key.Char "7"
- , KEY_8 = Key.Char "8"
- , KEY_9 = Key.Char "9"
- , KEY_0 = Key.Char "0"
- , KEY_MINUS = Key.Char "-"
- , KEY_EQUAL = Key.Char "="
- , KEY_BACKSPACE = Key.Ascii 8
- , KEY_TAB = Key.Ascii 9
- , KEY_Q = Key.Char "q"
- , KEY_W = Key.Char "d"
- , KEY_E = Key.Char "r"
- , KEY_R = Key.Char "w"
- , KEY_T = Key.Char "b"
- , KEY_Y = Key.Char "j"
- , KEY_U = Key.Char "f"
- , KEY_I = Key.Char "u"
- , KEY_O = Key.Char "p"
- , KEY_P = Key.Char ";"
- , KEY_LEFTBRACE = Key.Char "["
- , KEY_RIGHTBRACE = Key.Char "]"
- , KEY_ENTER = Key.Ascii 10
- , KEY_A = Key.Char "a"
- , KEY_S = Key.Char "s"
- , KEY_D = Key.Char "h"
- , KEY_F = Key.Char "t"
- , KEY_G = Key.Char "g"
- , KEY_H = Key.Char "y"
- , KEY_J = Key.Char "n"
- , KEY_K = Key.Char "e"
- , KEY_L = Key.Char "o"
- , KEY_SEMICOLON = Key.Char "i"
- , KEY_APOSTROPHE = Key.Char "'"
- , KEY_GRAVE = Key.Char "`"
- , KEY_BACKSLASH = Key.Ascii 92
- , KEY_Z = Key.Char "z"
- , KEY_X = Key.Char "x"
- , KEY_C = Key.Char "m"
- , KEY_V = Key.Char "c"
- , KEY_B = Key.Char "v"
- , KEY_N = Key.Char "k"
- , KEY_M = Key.Char "l"
- , KEY_COMMA = Key.Char ","
- , KEY_DOT = Key.Char "."
- , KEY_SLASH = Key.Char "/"
- , KEY_SPACE = Key.Char " "
- , KEY_KP7 = Key.Char "7"
- , KEY_KP8 = Key.Char "8"
- , KEY_KP9 = Key.Char "9"
- , KEY_KPMINUS = Key.Char "-"
- , KEY_KP4 = Key.Char "4"
- , KEY_KP5 = Key.Char "5"
- , KEY_KP6 = Key.Char "6"
- , KEY_KPPLUS = Key.Char "+"
- , KEY_KP1 = Key.Char "1"
- , KEY_KP2 = Key.Char "2"
- , KEY_KP3 = Key.Char "3"
- , KEY_KP0 = Key.Char "0"
- , KEY_KPDOT = Key.Char "."
- , KEY_KPENTER = Key.Ascii 10
- , KEY_KPSLASH = Key.Char "/"
- }
- }
- , Map::{
- , mod1 = True
- , keys = toMap
- { KEY_1 = Key.Char "!"
- , KEY_2 = Key.Char "@"
- , KEY_3 = Key.Char "#"
- , KEY_4 = Key.Char "\$"
- , KEY_5 = Key.Char "%"
- , KEY_6 = Key.Char "^"
- , KEY_7 = Key.Ascii 38
- , KEY_8 = Key.Char "*"
- , KEY_9 = Key.Char "("
- , KEY_0 = Key.Char ")"
- , KEY_MINUS = Key.Char "_"
- , KEY_EQUAL = Key.Char "+"
- , KEY_Q = Key.Char "Q"
- , KEY_W = Key.Char "D"
- , KEY_E = Key.Char "R"
- , KEY_R = Key.Char "W"
- , KEY_T = Key.Char "B"
- , KEY_Y = Key.Char "J"
- , KEY_U = Key.Char "F"
- , KEY_I = Key.Char "U"
- , KEY_O = Key.Char "P"
- , KEY_P = Key.Char ":"
- , KEY_LEFTBRACE = Key.Char "{"
- , KEY_RIGHTBRACE = Key.Char "}"
- , KEY_A = Key.Char "A"
- , KEY_S = Key.Char "S"
- , KEY_D = Key.Char "H"
- , KEY_F = Key.Char "T"
- , KEY_G = Key.Char "G"
- , KEY_H = Key.Char "Y"
- , KEY_J = Key.Char "N"
- , KEY_K = Key.Char "E"
- , KEY_L = Key.Char "O"
- , KEY_SEMICOLON = Key.Char "I"
- , KEY_APOSTROPHE = Key.Ascii 34
- , KEY_GRAVE = Key.Char "~"
- , KEY_BACKSLASH = Key.Char "|"
- , KEY_Z = Key.Char "Z"
- , KEY_X = Key.Char "X"
- , KEY_C = Key.Char "M"
- , KEY_V = Key.Char "C"
- , KEY_B = Key.Char "V"
- , KEY_N = Key.Char "K"
- , KEY_M = Key.Char "L"
- , KEY_COMMA = Key.Ascii 60
- , KEY_DOT = Key.Ascii 62
- , KEY_SLASH = Key.Char "?"
- }
- }
- , Map::{
- , mod2 = True
- , keys = toMap
- { KEY_A = Key.Ascii 1
- , KEY_B = Key.Ascii 22
- , KEY_C = Key.Ascii 13
- , KEY_D = Key.Ascii 8
- , KEY_E = Key.Ascii 18
- , KEY_F = Key.Ascii 20
- , KEY_G = Key.Ascii 7
- , KEY_H = Key.Ascii 25
- , KEY_I = Key.Ascii 21
- , KEY_J = Key.Ascii 14
- , KEY_K = Key.Ascii 5
- , KEY_L = Key.Ascii 15
- , KEY_M = Key.Ascii 12
- , KEY_N = Key.Ascii 11
- , KEY_O = Key.Ascii 16
- , KEY_P = Key.Ascii 9
- , KEY_Q = Key.Ascii 17
- , KEY_R = Key.Ascii 23
- , KEY_S = Key.Ascii 19
- , KEY_T = Key.Ascii 2
- , KEY_U = Key.Ascii 6
- , KEY_V = Key.Ascii 3
- , KEY_W = Key.Ascii 4
- , KEY_X = Key.Ascii 24
- , KEY_Y = Key.Ascii 10
- , KEY_Z = Key.Ascii 26
- }
- }
- , Map::{
- , mod3 = True
- , keys = toMap
- { KEY_4 = Key.Code 8364
- , KEY_A = Key.Code 228
- , KEY_S = Key.Code 223
- , KEY_I = Key.Code 252
- , KEY_DOT = Key.Code 8230
- , KEY_K = Key.Code 235
- , KEY_C = Key.Code 181
- , KEY_L = Key.Code 246
- }
- }
- , Map::{
- , mod1 = True
- , mod3 = True
- , keys = toMap
- { KEY_0 = Key.Code 8320
- , KEY_1 = Key.Code 8321
- , KEY_2 = Key.Code 8322
- , KEY_3 = Key.Code 8323
- , KEY_4 = Key.Code 8324
- , KEY_5 = Key.Code 8325
- , KEY_6 = Key.Code 8326
- , KEY_7 = Key.Code 8327
- , KEY_8 = Key.Code 8328
- , KEY_9 = Key.Code 8329
- }
- }
- ]
-
-in Prelude.List.map Map.Type XML.Type mapToXML workman