diff --git a/compositions/pc-drivers.dhall b/compositions/pc-drivers.dhall
deleted file mode 100644
index 8b2b905..0000000
--- a/compositions/pc-drivers.dhall
+++ /dev/null
@@ -1,246 +0,0 @@
-
-let Sigil = env:DHALL_SIGIL
-
-let Prelude = Sigil.Prelude
-
-let XML = Prelude.XML
-
-let Init = Sigil.Init
-
-let Child = Init.Child
-
-let Resources = Init.Resources
-
-let ServiceRoute = Init.ServiceRoute
-
-let label =
- λ(label : Text)
- → { local = label, route = label } : Child.Attributes.Label
-
-let relabel =
- λ(local : Text)
- → λ(route : Text)
- → { local = local, route = route } : Child.Attributes.Label
-
-let drivers =
- Init::{
- , routes = [ ServiceRoute.parent "Timer" ]
- , services =
- [ ServiceRoute.child "Framebuffer" "dynamic"
- , ServiceRoute.child "Block" "dynamic"
- , ServiceRoute.child "Usb" "usb_drv"
- , ServiceRoute.child "Platform" "platform_drv"
- , ServiceRoute.child "Input" "event_filter"
- ]
- , children = toMap
- { rom_reporter =
- Child.flat
- Child.Attributes::{
- , binary = "rom_reporter"
- , config = Init.Config::{
- , content =
- [ XML.text
- ''
-
-
-
- ''
- ]
- }
- , reportRoms =
- [ label "acpi", label "pci_devices", label "usb_devices" ]
- , routes =
- let routeReportToParent =
- λ(label : Text)
- → ServiceRoute.parentLabel
- "Report"
- (Some label)
- (Some label)
-
- in [ routeReportToParent "acpi"
- , routeReportToParent "pci_devices"
- , routeReportToParent "usb_devices"
- ]
- }
- , acpi_drv =
- Child.flat
- Child.Attributes::{
- , binary = "acpi_drv"
- , priority = 1
- , resources = Resources::{
- , caps = 350
- , ram = Sigil.units.MiB 4
- }
- , romReports = [ label "acpi" ]
- , routes =
- [ ServiceRoute.parent "IO_MEM"
- , ServiceRoute.parentLabel
- "Report"
- (Some "smbios_table")
- (Some "smbios_table")
- ]
- }
- , platform_drv =
- Child.flat
- Child.Attributes::{
- , binary = "platform_drv"
- , resources = Resources::{
- , caps = 400
- , ram = Sigil.units.MiB 4
- , constrainPhys = True
- }
- , provides = [ "Acpi", "Platform" ]
- , reportRoms = [ label "acpi" ]
- , romReports = [ relabel "pci" "pci_devices" ]
- , 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 =
- [ XML.text
- ''
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ''
- ]
- }
- }
- , usb_drv =
- Child.flat
- Child.Attributes::{
- , binary = "usb_drv"
- , priority = 1
- , resources = Resources::{
- , caps = 200
- , ram = Sigil.units.MiB 16
- }
- , provides = [ "Input", "Usb" ]
- , reportRoms = [ relabel "config" "usb_drv.config" ]
- , romReports = [ relabel "devices" "usb_devices" ]
- , routes =
- [ ServiceRoute.child "Platform" "platform_drv"
- , ServiceRoute.parentLabel
- "Report"
- (Some "config")
- (Some "usb_active_config")
- ]
- }
- , ps2_drv =
- Child.flat
- Child.Attributes::{
- , binary = "ps2_drv"
- , provides = [ "Input" ]
- , routes = [ ServiceRoute.child "Platform" "platform_drv" ]
- }
- , event_filter =
- Child.flat
- Child.Attributes::{
- , binary = "event_filter"
- , priority = 1
- , resources = Resources::{ ram = Sigil.units.MiB 2 }
- , provides = [ "Input" ]
- , routes =
- [ ServiceRoute.parentLabel
- "ROM"
- (Some "config")
- (Some "event_filter.config")
- , ServiceRoute.childLabel
- "Input"
- "ps2_drv"
- (Some "ps2")
- (None Text)
- , ServiceRoute.childLabel
- "Input"
- "usb_drv"
- (Some "usb")
- (None Text)
- ]
- }
- , driver_manager =
- Child.flat
- Child.Attributes::{
- , binary = "driver_manager"
- , priority = 1
- , reportRoms =
- [ label "ahci_ports"
- , label "nvme_ns"
- , label "pci_devices"
- , label "usb_devices"
- ]
- , romReports =
- [ relabel "init.config" "dynamic.config"
- , label "usb_drv.config"
- ]
- , routes =
- [ ServiceRoute.parentLabel
- "Report"
- (Some "block_devices")
- (Some "block_devices")
- , ServiceRoute.parentLabel
- "ROM"
- (Some "usb_policy")
- (Some "usb_policy")
- ]
- }
- , dynamic =
- Child.flat
- Child.Attributes::{
- , binary = "init"
- , priority = 1
- , resources = Resources::{
- , caps = 1400
- , ram = Sigil.units.MiB 64
- }
- , provides = [ "Framebuffer", "Block" ]
- , romReports = [ label "ahci_ports", label "nvme_ns" ]
- , reportRoms = [ relabel "config" "dynamic.config" ]
- , routes =
- [ ServiceRoute.child "Platform" "platform_drv"
- , ServiceRoute.child "Usb" "usb_drv"
- , ServiceRoute.parent "Timer"
- , ServiceRoute.parent "Report"
- , ServiceRoute.parent "IO_MEM"
- , ServiceRoute.parent "IO_PORT"
- ]
- }
- }
- }
-
-in drivers
diff --git a/nixos-modules/gui/gui.dhall b/nixos-modules/gui/gui.dhall
new file mode 100644
index 0000000..9c99707
--- /dev/null
+++ b/nixos-modules/gui/gui.dhall
@@ -0,0 +1,242 @@
+let Sigil = env:DHALL_SIGIL
+
+let Prelude = Sigil.Prelude
+
+let Map = Prelude.Map
+
+let Attributes = Map.Type Text Text
+
+let XML = Prelude.XML
+
+let Init = Sigil.Init
+
+let forward = λ(x : Text) → { local = x, route = x }
+
+let Domain/Type = { name : Text, layer : Natural, attrs : Attributes }
+
+let Domain/toXML =
+ λ(domain : Domain/Type) →
+ XML.leaf
+ { name = "domain"
+ , attributes =
+ toMap
+ { name = domain.name
+ , layer = Prelude.Natural.show domain.layer
+ }
+ # domain.attrs
+ }
+
+let nitpickerDomains =
+ [ { name = "pointer"
+ , layer = 1
+ , attrs = toMap { content = "client", label = "no", origin = "pointer" }
+ }
+ , { name = "decorator"
+ , layer = 2
+ , attrs = toMap
+ { content = "client"
+ , label = "no"
+ , focus = "click"
+ , hover = "transient"
+ }
+ }
+ , { name = "other", layer = 2, attrs = toMap { content = "client" } }
+ , { name = "wm"
+ , layer = 3
+ , attrs = toMap
+ { content = "client"
+ , label = "no"
+ , focus = "click"
+ , hover = "always"
+ }
+ }
+ , { name = "backdrop"
+ , layer = 4
+ , attrs = toMap { content = "client", label = "no", backdrop = "yes" }
+ }
+ ]
+
+let BinaryField = { binary : Text }
+
+in λ ( params
+ : { decorator : BinaryField
+ , layouter : BinaryField
+ , nitpicker : BinaryField
+ , pointer : BinaryField
+ , wm : BinaryField
+ }
+ ) →
+ λ(binary : Text) →
+ Init.toChild
+ Init::{
+ , verbose = True
+ , children = toMap
+ { nitpicker =
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary = params.nitpicker.binary
+ , resources = Init.Resources::{ ram = Sigil.units.MiB 4 }
+ , config = Init.Config::{
+ , attributes = toMap { focus = "rom" }
+ , content =
+ [ XML.leaf
+ { name = "capture"
+ , attributes = XML.emptyAttributes
+ }
+ , XML.leaf
+ { name = "event"
+ , attributes = XML.emptyAttributes
+ }
+ , XML.leaf
+ { name = "report"
+ , attributes = toMap
+ { hover = "yes"
+ , focus = "yes"
+ , clicked = "yes"
+ , keystate = "no"
+ }
+ }
+ , XML.leaf
+ { name = "background"
+ , attributes = toMap { color = "#ffffff" }
+ }
+ ]
+ # Prelude.List.map
+ Domain/Type
+ XML.Type
+ Domain/toXML
+ nitpickerDomains
+ , defaultPolicy = Some Init.Config.DefaultPolicy::{
+ , attributes = toMap { domain = "other" }
+ }
+ , policies =
+ [ Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.prefix "pointer"
+ , attributes = toMap { domain = "pointer" }
+ }
+ , Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.prefix "decorator"
+ , attributes = toMap { domain = "decorator" }
+ }
+ , Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.prefix "wm"
+ , attributes = toMap { domain = "wm" }
+ }
+ , Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.suffix "backdrop"
+ , attributes = toMap { domain = "backdrop" }
+ }
+ ]
+ }
+ , provides = [ "Capture", "Event" ]
+ , produceReports =
+ let f =
+ λ(report : Text) →
+ { report, rom = "nitpicker_" ++ local }
+
+ in [ f "hover", f "clicked", f "focus" ]
+ }
+ , pointer =
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary = params.pointer.binary
+ , config = Init.Config::{
+ , attributes = toMap { shape = "yes" }
+ }
+ , provides = [ "Report" ]
+ , reportRoms = [ forward "hover", forward "xray" ]
+ , resources = Init.Resources::{ ram = Sigil.units.MiB 2 }
+ }
+ , decorator =
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary = params.decorator.binary
+ , config = Init.Config::{
+ , content =
+ Prelude.List.map
+ Text
+ XML.Type
+ ( λ(name : Text) →
+ XML.leaf
+ { name, attributes = XML.emptyAttributes }
+ )
+ [ "maximizer", "title" ]
+ }
+ , resources = Init.Resources::{
+ , caps = 384
+ , ram = Sigil.units.MiB 12
+ }
+ , consumeReports =
+ [ forward "window_layout"
+ , { rom = "pointer", report = "wm_pointer" }
+ ]
+ , produceReports =
+ [ forward "decorator_margins"
+ , { report = "hover", rom = "decorator_hover" }
+ ]
+ }
+ , layouter =
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary = params.layouter.binary
+ , resources = Init.Resources::{ ram = Sigil.units.MiB 4 }
+ , consumeReports =
+ [ forward "decorator_margins"
+ , forward "focus_request"
+ , { rom = "hover", report = "decorator_hover" }
+ , { rom = "rules", report = "layouter_rules" }
+ , forward "window_list"
+ ]
+ , procdueReports =
+ [ forward "window_layout"
+ , forward "resize_request"
+ , { report = "focus", rom = "layouter_focus" }
+ , { repot = "rules", rom = "layouter_rules" }
+ ]
+ }
+ , wm =
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary = params.wm.binary
+ , config = Init.Config::{
+ , defaultPolicy = Some Init.Config.DefaultPolicy::{=}
+ , policies =
+ [ Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.prefix "decorator"
+ , attributes = toMap { role = "decorator" }
+ }
+ , Init.Config.Policy::{
+ , service = "Gui"
+ , label = Init.LabelSelector.prefix "layouter"
+ , attributes = toMap { role = "layouter" }
+ }
+ ]
+ }
+ , provides = [ "Gui", "Report", "ROM" ]
+ , consumeReports =
+ [ forward "resize_request"
+ , { rom = "focus", report = "layouter_focus" }
+ ]
+ , produceReports =
+ [ forward "focus_request"
+ , { report = "pointer", rom = "wm_pointer" }
+ , forward "window_list"
+ ]
+ , resources = Init.Resources::{
+ , caps = 256
+ , ram = Sigil.units.MiB 8
+ }
+ }
+ }
+ , services =
+ [ Init.ServiceRoute.child "Gui" "wm"
+ , Init.ServiceRoute.child "Report" "wm"
+ , Init.ServiceRoute.child "ROM" "wm"
+ ]
+ }
+ Init.Attributes::{ binary }
diff --git a/nixos-modules/gui/nitpicker.dhall b/nixos-modules/gui/nitpicker.dhall
deleted file mode 100644
index 25c4f99..0000000
--- a/nixos-modules/gui/nitpicker.dhall
+++ /dev/null
@@ -1,53 +0,0 @@
-let Sigil = env:DHALL_SIGIL
-
-let Prelude = Sigil.Prelude
-
-let Map = Prelude.Map
-
-let Attributes = Map.Type Text Text
-
-let Domain = Map.Entry Text Attributes
-
-let XML = Prelude.XML
-
-let Init = Sigil.Init
-
-in λ ( params
- : { domains : List Domain, policies : List Init.Config.Policy.Type }
- ) →
- λ(binary : Text) →
- Init.Child.flat
- Init.Child.Attributes::{
- , binary
- , resources = Init.Resources::{ ram = Sigil.units.MiB 4 }
- , config = Init.Config::{
- , attributes = toMap
- { note = "Nitpicker config is extremely fragile!" }
- , content =
- [ XML.leaf
- { name = "capture", attributes = XML.emptyAttributes }
- , XML.leaf
- { name = "background"
- , attributes = toMap { color = "#000000" }
- }
- ]
- # Prelude.List.map
- Domain
- XML.Type
- ( λ(domain : Domain) →
- XML.leaf
- { name = "domain"
- , attributes =
- toMap { name = domain.mapKey } # domain.mapValue
- }
- )
- params.domains
- , policies =
- params.policies
- # [ Init.Config.Policy::{
- , service = "Capture"
- , label = Init.LabelSelector.prefix "fb_drv"
- }
- ]
- }
- }
diff --git a/nixos-modules/hardware/acpi_drv.dhall b/nixos-modules/hardware/acpi_drv.dhall
new file mode 100644
index 0000000..475d989
--- /dev/null
+++ b/nixos-modules/hardware/acpi_drv.dhall
@@ -0,0 +1,24 @@
+let Sigil = env:DHALL_SIGIL
+
+let Init = Sigil.Init
+
+in λ(binary : Text) →
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary
+ , priorityOffset = 1
+ , resources = Init.Resources::{
+ , caps = 400
+ , ram = Sigil.units.MiB 4
+ , constrainPhys = True
+ }
+ , routes =
+ [ Init.ServiceRoute.parent "IRQ"
+ , Init.ServiceRoute.parent "IO_MEM"
+ , Init.ServiceRoute.parent "IO_PORT"
+ ]
+ , produceReports =
+ let f = λ(x : Text) → { report = x, rom = x }
+
+ in [ f "acpi", f "smbios_table" ]
+ }
diff --git a/nixos-modules/hardware/default.nix b/nixos-modules/hardware/default.nix
index 5de6a93..6166f15 100644
--- a/nixos-modules/hardware/default.nix
+++ b/nixos-modules/hardware/default.nix
@@ -64,66 +64,42 @@ in {
genode.core.children.acpi_drv = {
package = pkgs.genodePackages.acpi_drv;
- configFile = pkgs.writeText "acpi_drv.dhall" ''
- let Sigil = env:DHALL_SIGIL
-
- let Init = Sigil.Init
-
- let label = λ(_ : Text) → { local = _, route = _ }
-
- in λ(binary : Text) →
- Init.Child.flat
- Init.Child.Attributes::{
- , binary
- , priorityOffset = 1
- , resources = Init.Resources::{
- , caps = 400
- , ram = Sigil.units.MiB 4
- , constrainPhys = True
- }
- , romReports = [ label "acpi", label "smbios_table" ]
- , routes =
- [ Init.ServiceRoute.parent "IRQ"
- , Init.ServiceRoute.parent "IO_MEM"
- , Init.ServiceRoute.parent "IO_PORT"
- ]
- }
- '';
+ configFile = ./acpi_drv.dhall;
};
genode.core.children.platform_drv = {
package = pkgs.genodePackages.platform_drv;
- configFile = let
- policies =
- map (policy: ", ${policy}") config.hardware.genode.platform.policies;
- in pkgs.writeText "platform_drv.dhall" ''
- let Sigil = env:DHALL_SIGIL
+ configFile =
+ let policies = map (policy: ", ${policy}") cfg.platform.policies;
+ in pkgs.writeText "platform_drv.dhall" ''
+ let Sigil = env:DHALL_SIGIL
- let Init = Sigil.Init
+ let Init = Sigil.Init
- in λ(binary : Text) -> Init.Child.flat
- Init.Child.Attributes::{
- , binary
- , priorityOffset = 1
- , resources = Init.Resources::{
- , caps = 800
- , ram = Sigil.units.MiB 4
- , constrainPhys = True
- }
- , reportRoms = let label = "acpi" in [ { local = label, route = label } ]
- , provides = [ "Platform" ]
- , routes =
- [ Init.ServiceRoute.parent "IRQ"
- , Init.ServiceRoute.parent "IO_MEM"
- , Init.ServiceRoute.parent "IO_PORT"
- ]
- , config = Init.Config::{
- , policies = [ ${
- toString policies
- } ] : List Init.Config.Policy.Type
- }
- }
- '';
+ in λ(binary : Text) →
+ Init.Child.flat
+ Init.Child.Attributes::{
+ , binary
+ , priorityOffset = 1
+ , resources = Init.Resources::{
+ , caps = 800
+ , ram = Sigil.units.MiB 4
+ , constrainPhys = True
+ }
+ , consumeReports = [ { rom = "acpi", report = "acpi" } ]
+ , provides = [ "Platform" ]
+ , routes =
+ [ Init.ServiceRoute.parent "IRQ"
+ , Init.ServiceRoute.parent "IO_MEM"
+ , Init.ServiceRoute.parent "IO_PORT"
+ ]
+ , config = Init.Config::{
+ , policies = [ ${
+ toString policies
+ } ] : List Init.Config.Policy.Type
+ }
+ }
+ '';
};
genode.core.children.device_manager = lib.mkIf deviceManagerEnable {
diff --git a/packages/dhall/sigil.nix b/packages/dhall/sigil.nix
index 2baff9a..3dda447 100644
--- a/packages/dhall/sigil.nix
+++ b/packages/dhall/sigil.nix
@@ -4,8 +4,8 @@ dhallPackages.buildDhallDirectoryPackage {
name = "dhall-sigil";
src = fetchgit {
url = "https://git.sr.ht/~ehmry/dhall-sigil";
- rev = "fbdec3209f6e5aaa95abd2d1121164e31896b1df";
- sha256 = "0h19nm0wrflnl16klnwgcj8316fnx0v7d3rqnv87pq63dar4sjk9";
+ rev = "692f04344713b472e35a03eb80c7c37e2d812125";
+ sha256 = "14hynnhidnj3fwfsiwri0pi9gqhb7lliq14avx4hzc13r2z96cx1";
};
dependencies = [ dhallPackages.Prelude ];
}