Browse Source

Cleanup dead nixos-module code

remotes/server7/dabus
Emery Hemingway 10 months ago
parent
commit
32f1ee1fe7
  1. 4
      flake.nix
  2. 284
      nixos-modules/default.nix
  3. 201
      nixos-modules/dhall/console.dhall
  4. 56
      nixos-modules/dhall/fs-log.dhall
  5. 105
      nixos-modules/dhall/graphical-log.dhall
  6. 23
      nixos-modules/dhall/intel_fb_drv.dhall
  7. 1
      nixos-modules/dhall/partition-type
  8. 297
      nixos-modules/dhall/qwerty.chargen.dhall
  9. 745
      nixos-modules/dhall/root.dhall
  10. 41
      nixos-modules/dhall/show_input.dhall
  11. 219
      nixos-modules/dhall/vbox-guest.dhall
  12. 27
      nixos-modules/dhall/vesa_fb_drv.dhall
  13. 237
      nixos-modules/dhall/wm.dhall
  14. 245
      nixos-modules/dhall/workman.chargen.dhall
  15. 912
      tests/test-driver/test-driver.py

4
flake.nix

@ -131,10 +131,6 @@
packages = self.packages.${system};
});
nixosModules =
# Modules for composing Genode and NixOS
import ./nixos-modules { inherit self; };
checks =
# Checks for continous testing
let tests = import ./tests;

284
nixos-modules/default.nix

@ -1,284 +0,0 @@
{ self }: {
genodeHost = { config, lib, pkgs, modulesPath, ... }:
let
apps' = self.apps.x86_64-linux-x86_64-genode;
config' = config;
lib' = self.lib.x86_64-linux-x86_64-genode;
pkgs' = self.packages.x86_64-linux-x86_64-genode;
legacyPackages' = self.legacyPackages.x86_64-linux-x86_64-genode;
modulesPath' = "${self.inputs.nixpkgs}/nixos/modules";
genodeConfig = config.genode;
console = lib'.runDhallCommand "vbox.dhall" { } ''
dhall > $out <<< '${
./dhall/console.dhall
} { bash = "${legacyPackages'.bash}", coreutils = "${legacyPackages'.coreutils}", path = "${
lib.makeSearchPathOutput "bin" "bin"
(with legacyPackages'; [ bash coreutils ])
}" }'
'';
guestChildren = lib'.runDhallCommand "vbox.dhall" { } (''
dhall > $out << END
let Genode = env:DHALL_GENODE
in [
'' + builtins.concatStringsSep "," (lib.mapAttrsToList (vmName: cfg:
let
inherit (cfg) config;
boot = {
iso = rec {
filename = "nixos.iso";
drv = pkgs.callPackage
"${modulesPath'}/../lib/make-iso9660-image.nix"
# call the ISO utility from our nixpkgs with the package set of the guest
{
isoName = filename;
inherit (config.isoImage) volumeID contents;
};
format = "< ISO | VDI >.ISO";
storeRoot = "${baseNameOf drv}/iso";
uuid = "81763434-9a51-49e8-9444-528a5a28c4bc";
};
vdi = rec {
filename = "nixos.vdi";
drv = import "${modulesPath'}/../lib/make-disk-image.nix" {
inherit config lib pkgs;
diskSize = config.virtualbox.baseImageSize;
partitionTableType = "legacy";
name = "nixos-${pkgs.stdenv.hostPlatform.system}.vdi";
format = "vdi";
};
format = "< ISO | VDI >.VDI";
storeRoot = baseNameOf drv;
uuid = ''
$(${pkgs.virtualbox}/bin/VBoxManage showmediuminfo "${boot.drv}/${boot.filename}" | awk '/^UUID:/ {print $2}')'';
};
}.${cfg.bootFormat};
in lib'.runDhallCommand "vbox.dhall" { } ''
bootUuid=${boot.uuid}
dhall > $out << END
{ mapKey = "vbox-${vmName}"
, mapValue =
${./dhall/vbox-guest.dhall}
{ bootFilename = "${boot.filename}"
, bootFormat = ${boot.format}
, bootPkg = "${boot.storeRoot}"
, bootUuid = "$bootUuid"
, memorySize = ${toString cfg.memorySize}
, vmName = "${vmName}"
}
}
END
'') config.genode.guests) + ''
] : Genode.Init.Children.Type
END
'');
initConfig = let
fbDriverConfig = {
intel = ./dhall/intel_fb_drv.dhall;
vesa = ./dhall/vesa_fb_drv.dhall;
}.${genodeConfig.fbDriver};
in ''
${
./dhall/root.dhall
} { fbDriver = ${fbDriverConfig}, guests = toMap { console = ${console} } # ${guestChildren}, inputFilterChargens = ${genodeConfig.inputFilter.extraChargen}, partitionType = ${
./dhall/partition-type
}, wm = ${./dhall/wm.dhall}, graphical-log = ${
./dhall/graphical-log.dhall
}, fs-log = ${
./dhall/fs-log.dhall
}, systemLabel = "${config.system.nixos.label}" }'';
buildBootDescription = self.legacyPackages.x86_64-linux.callPackage
./buildBootDescription.nix { lib = lib'; };
bootDescription = buildBootDescription {
inherit initConfig;
imageInputs = [ legacyPackages'.bash ] ++ map pkgs'.genodeSources.depot
([
"acpi_drv"
"ahci_drv"
"cached_fs_rom"
"chroot"
"decorator"
"event_filter"
"fs_log"
"gui_fb"
"init"
"ipxe_nic_drv"
"libc"
"libiconv"
"log_core"
"nic_router"
"nitpicker"
"part_block"
"platform_drv"
"posix"
"ps2_drv"
"report_rom"
"rom_to_file"
"rtc_drv"
"rump"
"stdcxx"
"terminal"
"terminal_log"
"usb_drv"
"vfs"
"vfs_audit"
"vfs_import"
"vfs_pipe"
"vfs_ttf"
"window_layouter"
"wm"
] ++ lib.optional (genodeConfig.guests != { }) "vbox5"
++ lib.optional (genodeConfig.fbDriver == "vesa") "vesa_drv"
++ lib.optional (genodeConfig.fbDriver == "intel") "intel_fb_drv")
++ (with pkgs'; [ base-nova block_router ]);
extraBinaries = [
"ld.lib.so"
"libc.so"
"libm.so"
"libposix.so"
"librump.so"
"librump_fs.so"
"libstdcxx.so"
"libvfs.so"
"libvfs_audit.so"
"libvfs_import.so"
"libvfs_pipe.so"
"libvfs_rump.so"
"libvfs_ttf.so"
] ++ lib.optionals (genodeConfig.guests != { }) [
"libc_pipe.so"
"libiconv.so"
"libqemu-usb.so"
];
extraRoms = {
"Inconsolata.ttf" =
"${pkgs.inconsolata}/share/fonts/truetype/inconsolata/Inconsolata-Regular.ttf";
"focus" = builtins.toFile "nitpicker-is-too-complicated.xml" ''
<focus label="focus"/>
'';
};
};
firmware = lib'.novaImage "stage0" { gzip = true; } bootDescription;
in {
options.genode = with lib; {
fbDriver = mkOption {
default = "vesa";
type = types.enum [ "intel" "vesa" ];
description = ''
Set framebuffer driver.
'';
};
guests = mkOption {
type = types.attrsOf (types.submodule
({ config, options, name, ... }: {
options = {
bootFormat = mkOption {
default = "vdi";
type = types.enum [ "iso" "vdi" ];
description = "Set boot media format.";
};
memorySize = mkOption {
type = types.int;
default = 1536;
description = ''
The amount of RAM in MiB allocated to the VirtualBox guest.
'';
};
config = mkOption {
description = ''
A specification of the desired configuration of this
guest VM, as a NixOS module.
'';
type = mkOptionType {
name = "Toplevel NixOS config";
merge = loc: defs:
(import "${modulesPath}/../lib/eval-config.nix" {
inherit (config'.nixpkgs) system;
modules = {
iso = [
"${modulesPath}/installer/cd-dvd/iso-image.nix"
];
vdi = [
"${modulesPath}/virtualisation/virtualbox-image.nix"
{
virtualbox.memorySize =
genodeConfig.guests.${name}.memorySize;
}
];
}.${genodeConfig.guests.${name}.bootFormat}
++ [{ system.nixos.tags = [ name ]; }]
++ (map (x: x.value) defs);
prefix = [ "guests" name ];
}).config;
};
};
};
}));
default = { };
};
inputFilter = {
extraChargen = mkOption {
description =
"Dhall expression of the type <code>List Prelude.XML.Type</code>";
type = types.str;
default = "${./dhall/qwerty.chargen.dhall}";
};
};
};
config = {
system.build.genode = {
inherit firmware console;
config = lib'.runDhallCommand "config.dhall" { }
''dhall > $out <<< "${initConfig}"'';
xml = lib'.runDhallCommand "config.xml" { }
''${apps'.render-init.program} <<< "${initConfig}" > $out'';
};
boot.loader.grub = {
extraEntries = ''
menuentry Genode on NOVA {
insmod multiboot2
insmod gzio
multiboot2 /bender
module2 /hypervisor hypervisor iommu novpid serial logmem
module2 /image.elf.gz image.elf
}
'';
extraFiles = {
"bender" = "${pkgs'.genodeSources}/tool/boot/bender";
"hypervisor" = "${pkgs'.NOVA}/hypervisor-x86_64";
"image.elf.gz" = "${firmware}/image.elf.gz";
};
};
};
};
workman-layout.genode.inputFilter.extraChargen =
"${./dhall/workman.chargen.dhall}";
}

201
nixos-modules/dhall/console.dhall

@ -1,201 +0,0 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
let Libc = Genode.Libc
let VFS = Genode.VFS
in λ(params : { bash : Text, coreutils : Text, path : Text }) →
let init =
Init::{
, verbose = True
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
Init.ServiceRoute.parent
[ "Gui", "Rtc", "Timer" ]
, children = toMap
{ gui_fb =
Child.flat
Child.Attributes::{
, binary = "gui_fb"
, config = Init.Config::{
, attributes = toMap
{ xpos = "10"
, ypos = "10"
, initial_width = "800"
, initial_height = "600"
}
}
, exitPropagate = True
, provides = [ "Framebuffer", "Input" ]
, resources = Resources::{ ram = Genode.units.MiB 8 }
}
, terminal =
Child.flat
Child.Attributes::{
, binary = "terminal"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "dir"
, attributes = toMap { name = "fonts" }
, content =
[ XML.leaf
{ name = "fs"
, attributes = toMap
{ label = "fonts" }
}
]
}
]
}
]
}
, provides = [ "Terminal" ]
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, routes =
[ ServiceRoute.child "Framebuffer" "gui_fb"
, ServiceRoute.child "Input" "gui_fb"
, ServiceRoute.parent "File_system"
]
}
, vfs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ VFS.vfs
[ VFS.dir
"dev"
[ VFS.leaf "log"
, VFS.leaf "null"
, VFS.dir "pipe" [ VFS.leaf "pipe" ]
, VFS.leaf "rtc"
, VFS.leaf "terminal"
, VFS.leaf "zero"
]
, VFS.dir
"usr"
[ VFS.dir
"bin"
[ VFS.symlink
"${params.coreutils}/bin/env"
"env"
]
]
, VFS.dir "tmp" [ VFS.leaf "ram" ]
, VFS.dir
"nix"
[ VFS.dir
"store"
[ VFS.fs VFS.FS::{ label = "nix-store" } ]
]
]
]
, policies =
[ Init.Config.Policy::{
, service = "File_system"
, attributes = toMap
{ root = "/", writeable = "yes" }
}
]
}
, provides = [ "File_system" ]
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
[ Init.ServiceRoute.parent "File_system"
, Init.ServiceRoute.child "Terminal" "terminal"
]
}
, store_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, routes = [ Init.ServiceRoute.child "File_system" "vfs" ]
}
, shell =
Child.flat
Child.Attributes::{
, binary = "bash"
, config =
Libc.toConfig
Libc::{
, stdin = Some "/dev/terminal"
, stdout = Some "/dev/terminal"
, stderr = Some "/dev/terminal"
, pipe = Some "/dev/pipe"
, rtc = Some "/dev/rtc"
, vfs = [ VFS.leaf "fs" ]
, env = toMap
{ TERM = "screen"
, PATH = "${params.path}"
, PS1 = "system:\$PWD"
}
, args = [ "bash" ]
}
, exitPropagate = True
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
[ Init.ServiceRoute.child "File_system" "vfs"
, { service =
{ name = "ROM"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "/nix/store/"
, suffix = None Text
}
}
, route =
Init.Route.Type.Child
{ name = "store_rom"
, label = None Text
, diag = None Bool
}
}
]
}
}
}
in Init.toChild
init
Init.Attributes::{
, routes =
[ ServiceRoute.parent "File_system"
, ServiceRoute.parent "Gui"
, ServiceRoute.parent "Rtc"
, ServiceRoute.parent "Timer"
]
}

56
nixos-modules/dhall/fs-log.dhall

@ -1,56 +0,0 @@
let Genode = env:DHALL_GENODE
let Init = Genode.Init
let Child = Init.Child
let ServiceRoute = Init.ServiceRoute
let routeLogRom =
λ(label : Text) → ServiceRoute.parentLabel "ROM" (Some "log") (Some label)
in Init::{
, verbose = True
, children = toMap
{ fs_log =
Child.flat
Child.Attributes::{
, binary = "fs_log"
, config = Init.Config::{
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { merge = "yes", truncate = "yes" }
}
}
, exitPropagate = True
, provides = [ "LOG" ]
, routes = [ ServiceRoute.parent "File_system" ]
}
, log_core =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "core_log"
, ServiceRoute.childLabel
"LOG"
"fs_log"
(Some "log")
(Some "core")
]
}
, log_kernel =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "kernel_log"
, ServiceRoute.childLabel
"LOG"
"fs_log"
(Some "log")
(Some "kernel")
]
}
}
, routes = [ ServiceRoute.parent "Timer" ]
}

105
nixos-modules/dhall/graphical-log.dhall

@ -1,105 +0,0 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
let routeLogRom =
λ(label : Text) → ServiceRoute.parentLabel "ROM" (Some "log") (Some label)
in Init::{
, verbose = True
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
Init.ServiceRoute.parent
[ "Gui", "Rtc", "Timer" ]
, children = toMap
{ gui_fb =
Child.flat
Child.Attributes::{
, binary = "gui_fb"
, config = Init.Config::{
, attributes = toMap
{ initial_width = "600", initial_height = "600" }
}
, exitPropagate = True
, provides = [ "Framebuffer", "Input" ]
, resources = Resources::{ ram = Genode.units.MiB 8 }
}
, terminal =
Child.flat
Child.Attributes::{
, binary = "terminal"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "dir"
, attributes = toMap { name = "fonts" }
, content =
[ XML.leaf
{ name = "fs"
, attributes = toMap { label = "fonts" }
}
]
}
]
}
]
}
, provides = [ "Terminal" ]
, resources = Resources::{ caps = 256, ram = Genode.units.MiB 4 }
, routes =
[ ServiceRoute.child "Framebuffer" "gui_fb"
, ServiceRoute.child "Input" "gui_fb"
, ServiceRoute.parent "File_system"
]
}
, terminal_log =
Child.flat
Child.Attributes::{
, binary = "terminal_log"
, provides = [ "LOG" ]
, routes = [ ServiceRoute.child "Terminal" "terminal" ]
}
, log_core =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "core_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "core")
]
}
, log_kernel =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "kernel_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "kernel")
]
}
}
}

23
nixos-modules/dhall/intel_fb_drv.dhall

@ -1,23 +0,0 @@
let Genode = env:DHALL_GENODE
let Init = Genode.Init
let Child = Init.Child
let ServiceRoute = Init.ServiceRoute
in Child.flat
Child.Attributes::{
, binary = "intel_fb_drv"
, provides = [ "Framebuffer" ]
, resources = Init.Resources::{ caps = 256, ram = Genode.units.MiB 48 }
, routes =
[ ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
, ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(Some "intel_fb_drv")
]
}

1
nixos-modules/dhall/partition-type

@ -1 +0,0 @@
"24b69406-18a1-428d-908e-d21a1437122c"

297
nixos-modules/dhall/qwerty.chargen.dhall

@ -1,297 +0,0 @@
let Genode = env:DHALL_GENODE
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 qwerty =
[ Map::{
, mod1 = False
, mod2 = False
, mod3 = False
, mod4 = False
, keys = toMap
{ KEY_1 = Key.Code 49
, KEY_2 = Key.Code 50
, KEY_3 = Key.Code 51
, KEY_4 = Key.Code 52
, KEY_5 = Key.Code 53
, KEY_6 = Key.Code 54
, KEY_7 = Key.Code 55
, KEY_8 = Key.Code 56
, KEY_9 = Key.Code 57
, KEY_0 = Key.Code 48
, KEY_MINUS = Key.Code 45
, KEY_EQUAL = Key.Code 61
, KEY_Q = Key.Code 113
, KEY_W = Key.Code 119
, KEY_E = Key.Code 101
, KEY_R = Key.Code 114
, KEY_T = Key.Code 116
, KEY_Y = Key.Code 121
, KEY_U = Key.Code 117
, KEY_I = Key.Code 105
, KEY_O = Key.Code 111
, KEY_P = Key.Code 112
, KEY_LEFTBRACE = Key.Code 91
, KEY_RIGHTBRACE = Key.Code 93
, KEY_A = Key.Code 97
, KEY_S = Key.Code 115
, KEY_D = Key.Code 100
, KEY_F = Key.Code 102
, KEY_G = Key.Code 103
, KEY_H = Key.Code 104
, KEY_J = Key.Code 106
, KEY_K = Key.Code 107
, KEY_L = Key.Code 108
, KEY_SEMICOLON = Key.Code 59
, KEY_APOSTROPHE = Key.Code 39
, KEY_GRAVE = Key.Code 96
, KEY_BACKSLASH = Key.Code 92
, KEY_Z = Key.Code 122
, KEY_X = Key.Code 120
, KEY_C = Key.Code 99
, KEY_V = Key.Code 118
, KEY_B = Key.Code 98
, KEY_N = Key.Code 110
, KEY_M = Key.Code 109
, KEY_COMMA = Key.Code 44
, KEY_DOT = Key.Code 46
, KEY_SLASH = Key.Code 47
, KEY_KPASTERISK = Key.Code 42
, KEY_SPACE = Key.Code 32
, KEY_KP7 = Key.Code 55
, KEY_KP8 = Key.Code 56
, KEY_KP9 = Key.Code 57
, KEY_KPMINUS = Key.Code 45
, KEY_KP4 = Key.Code 52
, KEY_KP5 = Key.Code 53
, KEY_KP6 = Key.Code 54
, KEY_KPPLUS = Key.Code 43
, KEY_KP1 = Key.Code 49
, KEY_KP2 = Key.Code 50
, KEY_KP3 = Key.Code 51
, KEY_KP0 = Key.Code 48
, KEY_KPDOT = Key.Code 46
, KEY_102ND = Key.Code 60
, KEY_KPSLASH = Key.Code 47
, KEY_ESC = Key.Ascii 27
, KEY_BACKSPACE = Key.Ascii 8
, KEY_TAB = Key.Ascii 9
, KEY_ENTER = Key.Ascii 10
, KEY_KPENTER = Key.Ascii 10
, KEY_DELETE = Key.Ascii 127
}
}
, Map::{
, mod1 = True
, mod2 = False
, mod3 = False
, mod4 = False
, keys = toMap
{ KEY_1 = Key.Code 33
, KEY_2 = Key.Code 64
, KEY_3 = Key.Code 35
, KEY_4 = Key.Code 36
, KEY_5 = Key.Code 37
, KEY_6 = Key.Code 94
, KEY_7 = Key.Code 38
, KEY_8 = Key.Code 42
, KEY_9 = Key.Code 40
, KEY_0 = Key.Code 41
, KEY_MINUS = Key.Code 95
, KEY_EQUAL = Key.Code 43
, KEY_Q = Key.Code 81
, KEY_W = Key.Code 87
, KEY_E = Key.Code 69
, KEY_R = Key.Code 82
, KEY_T = Key.Code 84
, KEY_Y = Key.Code 89
, KEY_U = Key.Code 85
, KEY_I = Key.Code 73
, KEY_O = Key.Code 79
, KEY_P = Key.Code 80
, KEY_LEFTBRACE = Key.Code 123
, KEY_RIGHTBRACE = Key.Code 125
, KEY_A = Key.Code 65
, KEY_S = Key.Code 83
, KEY_D = Key.Code 68
, KEY_F = Key.Code 70
, KEY_G = Key.Code 71
, KEY_H = Key.Code 72
, KEY_J = Key.Code 74
, KEY_K = Key.Code 75
, KEY_L = Key.Code 76
, KEY_SEMICOLON = Key.Code 58
, KEY_APOSTROPHE = Key.Code 34
, KEY_GRAVE = Key.Code 126
, KEY_BACKSLASH = Key.Code 124
, KEY_Z = Key.Code 90
, KEY_X = Key.Code 88
, KEY_C = Key.Code 67
, KEY_V = Key.Code 86
, KEY_B = Key.Code 66
, KEY_N = Key.Code 78
, KEY_M = Key.Code 77
, KEY_COMMA = Key.Code 60
, KEY_DOT = Key.Code 62
, KEY_SLASH = Key.Code 63
, KEY_KPASTERISK = Key.Code 42
, KEY_KPMINUS = Key.Code 45
, KEY_KPPLUS = Key.Code 43
, KEY_102ND = Key.Code 62
, KEY_KPSLASH = Key.Code 47
}
}
, Map::{
, mod1 = False
, mod2 = False
, mod3 = True
, mod4 = False
, keys = toMap { KEY_5 = Key.Code 8364, KEY_102ND = Key.Code 124 }
}
, Map::{
, mod1 = False
, mod2 = False
, mod3 = False
, mod4 = True
, keys = toMap
{ KEY_Q = Key.Code 81
, KEY_W = Key.Code 87
, KEY_E = Key.Code 69
, KEY_R = Key.Code 82
, KEY_T = Key.Code 84
, KEY_Y = Key.Code 89
, KEY_U = Key.Code 85
, KEY_I = Key.Code 73
, KEY_O = Key.Code 79
, KEY_P = Key.Code 80
, KEY_A = Key.Code 65
, KEY_S = Key.Code 83
, KEY_D = Key.Code 68
, KEY_F = Key.Code 70
, KEY_G = Key.Code 71
, KEY_H = Key.Code 72
, KEY_J = Key.Code 74
, KEY_K = Key.Code 75
, KEY_L = Key.Code 76
, KEY_Z = Key.Code 90
, KEY_X = Key.Code 88
, KEY_C = Key.Code 67
, KEY_V = Key.Code 86
, KEY_B = Key.Code 66
, KEY_N = Key.Code 78
, KEY_M = Key.Code 77
}
}
, Map::{
, mod1 = True
, mod2 = False
, mod3 = False
, mod4 = True
, keys = toMap
{ KEY_1 = Key.Code 33
, KEY_2 = Key.Code 64
, KEY_3 = Key.Code 35
, KEY_4 = Key.Code 36
, KEY_5 = Key.Code 37
, KEY_6 = Key.Code 94
, KEY_7 = Key.Code 38
, KEY_8 = Key.Code 42
, KEY_9 = Key.Code 40
, KEY_0 = Key.Code 41
, KEY_MINUS = Key.Code 95
, KEY_EQUAL = Key.Code 43
, KEY_Q = Key.Code 113
, KEY_W = Key.Code 119
, KEY_E = Key.Code 101
, KEY_R = Key.Code 114
, KEY_T = Key.Code 116
, KEY_Y = Key.Code 121
, KEY_U = Key.Code 117
, KEY_I = Key.Code 105
, KEY_O = Key.Code 111
, KEY_P = Key.Code 112
, KEY_LEFTBRACE = Key.Code 123
, KEY_RIGHTBRACE = Key.Code 125
, KEY_A = Key.Code 97
, KEY_S = Key.Code 115
, KEY_D = Key.Code 100
, KEY_F = Key.Code 102
, KEY_G = Key.Code 103
, KEY_H = Key.Code 104
, KEY_J = Key.Code 106
, KEY_K = Key.Code 107
, KEY_L = Key.Code 108
, KEY_SEMICOLON = Key.Code 58
, KEY_APOSTROPHE = Key.Code 34
, KEY_GRAVE = Key.Code 126
, KEY_BACKSLASH = Key.Code 124
, KEY_Z = Key.Code 122
, KEY_X = Key.Code 120
, KEY_C = Key.Code 99
, KEY_V = Key.Code 118
, KEY_B = Key.Code 98
, KEY_N = Key.Code 110
, KEY_M = Key.Code 109
, KEY_COMMA = Key.Code 60
, KEY_DOT = Key.Code 62
, KEY_SLASH = Key.Code 63
, KEY_102ND = Key.Code 62
}
}
]
in Prelude.List.map Map.Type XML.Type mapToXML qwerty

745
nixos-modules/dhall/root.dhall

@ -1,745 +0,0 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
let Policy = Init.Config.Policy
let DefaultPolicy = Init.Config.DefaultPolicy
let LabelSelector = Init.LabelSelector
let label =
λ(label : Text) →
{ local = label, route = label } : Child.Attributes.Label
let rootInit =
λ ( params
: { fbDriver : Init.Child.Type
, guests : Init.Children.Type
, inputFilterChargens : List XML.Type
, partitionType : Text
, wm : Init.Type
, graphical-log : Init.Type
, fs-log : Init.Type
, systemLabel : Text
}
) →
Init::{
, children = toMap
{ timer =
Child.flat
Child.Attributes::{
, binary = "timer_drv"
, provides = [ "Timer" ]
}
, rtc =
Child.flat
Child.Attributes::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes =
[ ServiceRoute.parent "IO_PORT"
, ServiceRoute.parent "IO_MEM"
]
}
, acpi_drv =
Child.flat
Child.Attributes::{
, binary = "acpi_drv"
, priority = 1
, resources = Resources::{
, caps = 350
, ram = Genode.units.MiB 4
}
, romReports = [ label "acpi", label "smbios_table" ]
, routes = [ ServiceRoute.parent "IO_MEM" ]
}
, platform_drv =
Child.flat
Child.Attributes::{
, binary = "platform_drv"
, resources = Resources::{
, caps = 400
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, reportRoms = [ label "acpi" ]
, romReports = [ label "pci" ]
, provides = [ "Acpi", "Platform" ]
, routes =
[ ServiceRoute.parent "IRQ"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
, ServiceRoute.parentLabel
"ROM"
(Some "system")
(Some "system")
]
, config = Init.Config::{
, attributes = toMap { system = "yes" }
, content =
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" }
, { labelSuffix = "vesa_fb_drv"
, pciClass = "VGA"
}
]
}
}
, framebuffer = params.fbDriver
, event_filter =
Child.flat
Child.Attributes::{
, binary = "event_filter"
, config =
let key =
λ(name : Text) →
XML.leaf
{ name = "key", attributes = toMap { name } }
let remap =
λ(name : Text) →
λ(to : Text) →
XML.leaf
{ name = "key"
, attributes = toMap { name, to }
}
in Init.Config::{
, content =
[ XML.leaf
{ name = "input"
, attributes = toMap { label = "ps2" }
}
, XML.leaf
{ name = "input"
, attributes = toMap { label = "usb" }
}
, XML.element
{ name = "output"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "chargen"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "remap"
, attributes =
XML.emptyAttributes
, content =
[ remap
"KEY_LEFTMETA"
"KEY_SCREEN"
, XML.element
{ name = "merge"
, attributes =
XML.emptyAttributes
, content =
[ XML.leaf
{ name = "input"
, attributes = toMap
{ name = "ps2" }
}
, XML.leaf
{ name = "input"
, attributes = toMap
{ name = "usb" }
}
]
}
]
}
, 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" ]
}
]
# params.inputFilterChargens
}
]
}
]
}
, provides = [ "Input" ]
, routes =
[ ServiceRoute.parentLabel
"ROM"
(Some "config")
(Some "config -> event_filter.config")
, ServiceRoute.childLabel
"Input"
"ps2_drv"
(Some "ps2")
(None Text)
, ServiceRoute.childLabel
"Input"
"usb_drv"
(Some "usb")
(None Text)
, ServiceRoute.child "Capture" "nitpicker"
]
}
, ps2_drv =
Child.flat
Child.Attributes::{
, binary = "ps2_drv"
, provides = [ "Input" ]
, routes =
[ ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(Some "ps2_drv")
]
}
, usb_drv =
Child.flat
Child.Attributes::{
, binary = "usb_drv"
, config = Init.Config::{
, attributes = toMap
{ uhci = "yes"
, ohci = "yes"
, ehci = "yes"
, xhci = "yes"
, bios_handoff = "yes"
}
, content =
[ XML.leaf
{ name = "hid", attributes = XML.emptyAttributes }
]
}
, provides = [ "Input" ]
, resources = Init.Resources::{
, caps = 128
, ram = Genode.units.MiB 12
}
, routes =
[ ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(Some "usb_drv")
]
}
, wm =
Init.toChild
params.wm
Init.Attributes::{
, provides = [ "Capture", "Event", "Gui", "Report", "ROM" ]
, romReports = [ label "clipboard", label "shape" ]
, routes =
[ ServiceRoute.child "Framebuffer" "framebuffer"
, ServiceRoute.child "Input" "event_filter"
]
}
, fonts_fs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.leaf
{ name = "rom"
, attributes = toMap
{ name = "Inconsolata.ttf" }
}
, XML.element
{ name = "dir"
, attributes = toMap { name = "fonts" }
, content =
[ XML.element
{ name = "dir"
, attributes = toMap { name = "title" }
, content =
[ XML.leaf
{ name = "ttf"
, attributes = toMap
{ name = "regular"
, path = "/Inconsolata.ttf"
, size_px = "12"
}
}
]
}
, XML.element
{ name = "dir"
, attributes = toMap { name = "text" }
, content =
[ XML.leaf
{ name = "ttf"
, attributes = toMap
{ name = "regular"
, path = "/Inconsolata.ttf"
, size_px = "12"
}
}
]
}
, XML.element
{ name = "dir"
, attributes = toMap
{ name = "annotation" }
, content =
[ XML.leaf
{ name = "ttf"
, attributes = toMap
{ name = "regular"
, path = "/Inconsolata.ttf"
, size_px = "12"
}
}
]
}
, XML.element
{ name = "dir"
, attributes = toMap
{ name = "monospace" }
, content =
[ XML.leaf
{ name = "ttf"
, attributes = toMap
{ name = "regular"
, path = "/Inconsolata.ttf"
, size_px = "12"
}
}
]
}
]
}
]
}
]
, defaultPolicy = Some DefaultPolicy::{
, attributes = toMap { root = "/fonts" }
}
}
, provides = [ "File_system" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 12
}
, routes = [ ServiceRoute.child "Block" "block_router" ]
}
, graphical-log =
Init.toChild
params.graphical-log
Init.Attributes::{
, routes =
[ ServiceRoute.child "Gui" "wm"
, ServiceRoute.child "File_system" "fonts_fs"
]
}
, fs-log =
Init.toChild
params.fs-log
Init.Attributes::{
, routes =
[ ServiceRoute.childLabel
"File_system"
"chroot"
(None Text)
(Some "dump")
]
}
, rom_to_file =
Child.flat
Child.Attributes::{
, binary = "rom_to_file"
, config = Init.Config::{
, attributes = toMap { rom = "init.config" }
}
, routes =
[ ServiceRoute.childLabel
"File_system"
"chroot"
(None Text)
(Some "dump")
, ServiceRoute.parentLabel
"ROM"
(Some "init.config")
(Some "config")
]
}
, block =
Child.flat
Child.Attributes::{
, binary = "ahci_drv"
, config = Init.Config::{
, defaultPolicy = Some DefaultPolicy::{
, attributes = toMap { device = "0", writeable = "yes" }
}
}
, provides = [ "Block" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 10
}
, routes =
[ ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(Some "ahci_drv")
]
}
, block_partitions =
Child.flat
Child.Attributes::{
, binary = "part_block"
, config = Init.Config::{
, content =
Prelude.List.map
Natural
XML.Type
( λ(i : Natural) →
XML.leaf
{ name = "policy"
, attributes =
let partition =
Prelude.Natural.show (i + 1)
in toMap
{ label_suffix = " ${partition}"
, partition
, writeable = "yes"
}
}
)
(Prelude.Natural.enumerate 128)
# [ XML.leaf
{ name = "report"
, attributes = toMap { partitions = "yes" }
}
]
}
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, provides = [ "Block" ]
, routes =
[ ServiceRoute.child "Block" "block"
, ServiceRoute.child "Report" "block_router"
]
}
, block_router =
Child.flat
Child.Attributes::{
, binary = "block_router"
, config = Init.Config::{
, attributes = toMap { verbose = "yes" }
, content =
[ XML.element
{ name = "default-policy"
, attributes = XML.emptyAttributes
, content =
[ XML.leaf
{ name = "partition"
, attributes = toMap
{ type = params.partitionType
, writeable = "yes"
}
}
]
}
]
}
, resources = Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, provides = [ "Block", "Report" ]
, routes = [ ServiceRoute.child "Block" "block_partitions" ]
}
, file_system =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "dir"
, attributes = toMap { name = "ext2" }
, content =
[ XML.leaf
{ name = "rump"
, attributes = toMap
{ fs = "ext2fs"
, writeable = "yes"
, ram = "8M"
}
}
]
}
]
}
]
, policies =
[ Policy::{
, label = LabelSelector.suffix "nix/store"
, attributes = toMap
{ root = "/ext2/nix/store", writeable = "no" }
}
, Policy::{
, label = LabelSelector.prefix "chroot"
, attributes = toMap
{ root = "/ext2", writeable = "yes", path = "/" }
}
, Policy::{
, label = LabelSelector.prefix "init -> console"
, attributes = toMap { root = "/", writeable = "yes" }
}
]
}
, provides = [ "File_system" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 12
}
, routes = [ ServiceRoute.child "Block" "block_router" ]
}
, chroot =
Child.flat
Child.Attributes::{
, binary = "chroot"
, config = Init.Config::{
, policies =
[ Policy::{
, label = LabelSelector.label "dump"
, attributes = toMap
{ path = params.systemLabel, writeable = "yes" }
}
]
, defaultPolicy = Some DefaultPolicy::{
, attributes = toMap { writeable = "yes" }
}
}
, provides = [ "File_system" ]
, routes = [ ServiceRoute.child "File_system" "file_system" ]
}
, nic_drv =
Child.flat
Child.Attributes::{
, binary = "ipxe_nic_drv"
, provides = [ "Nic" ]
, resources = Init.Resources::{
, caps = 128
, ram = Genode.units.MiB 4
}
, routes =
[ ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(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 }
Init.Attributes::{
, routes =
[ ServiceRoute.parent "VM"
, ServiceRoute.child "Gui" "wm"
, { service =
{ name = "File_system"
, label = LabelSelector.last "fonts"
}
, route =
Init.Route.Type.Child
{ name = "fonts_fs"
, label = None Text
, diag = None Bool
}
}
, { service =
{ name = "File_system"
, label = LabelSelector.suffix "nix/store"
}
, route =
Init.Route.Type.Child
{ name = "file_system"
, label = Some "nix/store"
, diag = None Bool
}
}
, { service =
{ name = "File_system"
, label = LabelSelector.prefix "console"
}
, route =
Init.Route.Type.Child
{ name = "file_system"
, label = None Text
, diag = None Bool
}
}
, ServiceRoute.child "File_system" "chroot"
, ServiceRoute.child "Nic" "nic_router"
, ServiceRoute.child "Rtc" "rtc"
, ServiceRoute.parentLabel
"ROM"
(Some "platform_info")
(Some "platform_info")
, ServiceRoute.child "Report" "_report_rom"
]
}
}
, routes = [ ServiceRoute.child "Timer" "timer" ]
}
in rootInit

41
nixos-modules/dhall/show_input.dhall

@ -1,41 +0,0 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
in Child.flat
Child.Attributes::{
, binary = "show_input"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "dir"
, attributes = toMap { name = "fonts" }
, content =
[ XML.leaf
{ name = "fs"
, attributes = toMap { label = "fonts" }
}
]
}
]
}
]
}
, resources = Resources::{ ram = Genode.units.MiB 32 }
, routes =
[ ServiceRoute.parent "File_system", ServiceRoute.parent "Gui" ]
}

219
nixos-modules/dhall/vbox-guest.dhall

@ -1,219 +0,0 @@