Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

console.dhall 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. let Genode = env:DHALL_GENODE
  2. let Prelude = Genode.Prelude
  3. let XML = Prelude.XML
  4. let Init = Genode.Init
  5. let Child = Init.Child
  6. let Resources = Init.Resources
  7. let ServiceRoute = Init.ServiceRoute
  8. in λ(params : { bash : Text, coreutils : Text, path : Text }) →
  9. let init =
  10. Init::{
  11. , verbose = True
  12. , routes =
  13. Prelude.List.map
  14. Text
  15. Init.ServiceRoute.Type
  16. Init.ServiceRoute.parent
  17. [ "Gui", "Rtc", "Timer" ]
  18. , children = toMap
  19. { gui_fb =
  20. Child.flat
  21. Child.Attributes::{
  22. , binary = "gui_fb"
  23. , config = Init.Config::{
  24. , attributes = toMap
  25. { xpos = "10"
  26. , ypos = "10"
  27. , initial_width = "800"
  28. , initial_height = "600"
  29. }
  30. }
  31. , exitPropagate = True
  32. , provides = [ "Framebuffer", "Input" ]
  33. , resources = Resources::{ ram = Genode.units.MiB 8 }
  34. }
  35. , terminal =
  36. Child.flat
  37. Child.Attributes::{
  38. , binary = "terminal"
  39. , config = Init.Config::{
  40. , content =
  41. [ XML.element
  42. { name = "vfs"
  43. , attributes = XML.emptyAttributes
  44. , content =
  45. [ XML.element
  46. { name = "dir"
  47. , attributes = toMap { name = "fonts" }
  48. , content =
  49. [ XML.leaf
  50. { name = "fs"
  51. , attributes = toMap
  52. { label = "fonts" }
  53. }
  54. ]
  55. }
  56. ]
  57. }
  58. ]
  59. }
  60. , provides = [ "Terminal" ]
  61. , resources = Resources::{
  62. , caps = 256
  63. , ram = Genode.units.MiB 4
  64. }
  65. , routes =
  66. [ ServiceRoute.child "Framebuffer" "gui_fb"
  67. , ServiceRoute.child "Input" "gui_fb"
  68. , ServiceRoute.parent "File_system"
  69. ]
  70. }
  71. , vfs =
  72. Child.flat
  73. Child.Attributes::{
  74. , binary = "vfs"
  75. , config = Init.Config::{
  76. , content =
  77. [ Prelude.XML.text
  78. ''
  79. <vfs>
  80. <dir name="dev">
  81. <log name="stderr" label="stderr"/>
  82. <log name="stdout" label="stdout"/>
  83. <null/>
  84. <pipe/>
  85. <rtc/>
  86. <terminal/>
  87. <zero/>
  88. </dir>
  89. <dir name="usr"><dir name="bin"><symlink name="env" target="${params.coreutils}/bin/env"/></dir></dir>
  90. <dir name="tmp"><ram/></dir>
  91. <dir name="nix"><dir name="store"><fs label="nix/store" writeable="no"/></dir></dir>
  92. </vfs>
  93. <default-policy root="/" writeable="yes"/>
  94. ''
  95. ]
  96. }
  97. , provides = [ "File_system" ]
  98. , resources = Resources::{
  99. , caps = 256
  100. , ram = Genode.units.MiB 8
  101. }
  102. , routes =
  103. [ Init.ServiceRoute.parent "File_system"
  104. , Init.ServiceRoute.child "Terminal" "terminal"
  105. ]
  106. }
  107. , store_rom =
  108. Child.flat
  109. Child.Attributes::{
  110. , binary = "cached_fs_rom"
  111. , provides = [ "ROM" ]
  112. , resources = Resources::{
  113. , caps = 256
  114. , ram = Genode.units.MiB 4
  115. }
  116. , routes = [ Init.ServiceRoute.child "File_system" "vfs" ]
  117. }
  118. , shell =
  119. Child.flat
  120. Child.Attributes::{
  121. , binary = "bash"
  122. , config = Genode.Init.Config::{
  123. , content =
  124. [ Prelude.XML.text
  125. ''
  126. <libc stdin="/dev/terminal" stdout="/dev/terminal" stderr="/dev/terminal" pipe="/dev/pipe" rtc="/dev/rtc"/>
  127. <vfs> <fs/> </vfs>
  128. <env key="TERM" value="screen"/>
  129. <env key="PATH" value="${params.path}" />
  130. <env key="PS1" value="system:$PWD> " />
  131. ''
  132. ]
  133. # Prelude.List.map
  134. Text
  135. XML.Type
  136. ( λ(x : Text) →
  137. XML.leaf
  138. { name = "arg"
  139. , attributes = toMap { value = x }
  140. }
  141. )
  142. [ "bash" ]
  143. }
  144. , exitPropagate = True
  145. , resources = Resources::{
  146. , caps = 256
  147. , ram = Genode.units.MiB 8
  148. }
  149. , routes =
  150. [ Init.ServiceRoute.child "File_system" "vfs"
  151. , { service =
  152. { name = "ROM"
  153. , label =
  154. Init.LabelSelector.Type.Partial
  155. { prefix = Some "/nix/store/"
  156. , suffix = None Text
  157. }
  158. }
  159. , route =
  160. Init.Route.Type.Child
  161. { name = "store_rom"
  162. , label = None Text
  163. , diag = None Bool
  164. }
  165. }
  166. ]
  167. }
  168. }
  169. }
  170. in Init.toChild
  171. init
  172. Init.Attributes::{
  173. , routes =
  174. [ ServiceRoute.parent "File_system"
  175. , ServiceRoute.parent "Gui"
  176. , ServiceRoute.parent "Rtc"
  177. , ServiceRoute.parent "Timer"
  178. ]
  179. }