sigil/tests/posix.dhall

118 lines
4.5 KiB
Plaintext
Raw Normal View History

2021-04-21 09:59:27 +02:00
let Sigil =
env:DHALL_SIGIL
? https://git.sr.ht/~ehmry/dhall-sigil/blob/trunk/package.dhall
2021-03-28 15:07:21 +02:00
let Prelude = Sigil.Prelude
2021-03-28 15:07:21 +02:00
let Init = Sigil.Init
2020-05-29 18:34:45 +02:00
let Child = Init.Child
2021-03-28 15:07:21 +02:00
let Libc = Sigil.Libc
2020-11-24 20:24:07 +01:00
2021-03-28 15:07:21 +02:00
let VFS = Sigil.VFS
2020-11-24 20:24:07 +01:00
2020-08-29 17:31:53 +02:00
in λ(params : { bash : Text, coreutils : Text, script : Text }) →
let init =
2020-05-29 18:34:45 +02:00
Init::{
, verbose = True
, routes =
[ Init.ServiceRoute.parent "Timer"
, Init.ServiceRoute.parent "Rtc"
]
, children = toMap
{ vfs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ Prelude.XML.text
''
<vfs>
<dir name="dev"> <log name="stdout" label="stdout"/> <log name="stderr" label="stderr"/> <null/> <pipe/> <rtc/> <zero/> </dir>
<dir name="usr"><dir name="bin"><symlink name="env" target="${params.coreutils}/bin/env"/></dir></dir>
<dir name="tmp"><ram/></dir>
<dir name="nix"><fs label="nix" root="nix"/></dir>
</vfs>
''
]
, policies =
[ Init.Config.Policy::{
, service = "File_system"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "shell", suffix = None Text }
, attributes = toMap
{ root = "/", writeable = "yes" }
}
]
2020-05-29 18:34:45 +02:00
}
, provides = [ "File_system" ]
2021-03-28 15:07:21 +02:00
, resources = Sigil.Init.Resources::{
2020-05-29 18:34:45 +02:00
, caps = 256
2021-03-28 15:07:21 +02:00
, ram = Sigil.units.MiB 8
2020-05-29 18:34:45 +02:00
}
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
Init.ServiceRoute.parent
[ "File_system", "Rtc" ]
}
, store_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Init.Resources::{
, caps = 256
2021-03-28 15:07:21 +02:00
, ram = Sigil.units.MiB 4
2020-05-29 18:34:45 +02:00
}
, routes =
[ Init.ServiceRoute.parentLabel
"File_system"
(None Text)
(Some "nix")
]
}
, shell =
Child.flat
Child.Attributes::{
, binary = "bash"
2020-11-24 20:24:07 +01:00
, config =
Libc.toConfig
Libc::{
, pipe = Some "/dev/pipe"
, rtc = Some "/dev/rtc"
, vfs = [ VFS.leaf "fs" ]
, args = [ "bash", params.script ]
}
2020-05-29 18:34:45 +02:00
, exitPropagate = True
2021-03-28 15:07:21 +02:00
, resources = Sigil.Init.Resources::{
2020-05-29 18:34:45 +02:00
, caps = 256
2021-03-28 15:07:21 +02:00
, ram = Sigil.units.MiB 8
2020-05-29 18:34:45 +02:00
}
, routes =
[ { service =
2020-08-29 17:31:53 +02:00
{ name = "ROM"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "/nix/store/"
, suffix = None Text
}
}
2020-05-29 18:34:45 +02:00
, route =
Init.Route.Type.Child
{ name = "store_rom"
, label = None Text
, diag = None Bool
}
}
]
}
}
2020-05-29 18:34:45 +02:00
}
2020-05-29 18:34:45 +02:00
in Test::{ children = Test.initToChildren init }