1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| | { writeScript, lib
, execline, s6, s6-portable-utils, s6-linux-utils, s6-linux-init, busybox, mesa
}:
{ run ? "true" }:
let
path = [ s6 s6-portable-utils s6-linux-utils s6-linux-init busybox execline ];
in
writeScript "init-stage1" ''
#! ${execline}/bin/execlineb -P
export PATH ${lib.makeBinPath path}
${s6}/bin/s6-setsid -qb --
importas -i spectrumcmd spectrumcmd
umask 022
if { s6-mount -t tmpfs -o mode=0755 tmpfs /run }
if { s6-hiercopy /etc/service /run/service }
emptyenv -p
background {
s6-setsid --
if { s6-mkdir -p /run/user/0 /dev/pts /dev/shm }
if { install -o user -g user -d /run/user/1000 }
if { s6-mount -t devpts -o gid=4,mode=620 none /dev/pts }
if { s6-mount -t tmpfs none /dev/shm }
if { s6-mount -t proc none /proc }
if { s6-ln -s ${mesa.drivers} /run/opengl-driver }
export HOME /
export XDG_RUNTIME_DIR /run/user/0
foreground {
ifelse { test -n $spectrumcmd }
{ pipeline { heredoc 0 $spectrumcmd base64 -d } /bin/sh }
${run}
}
importas -i ? ?
if { s6-echo STATUS: $? }
s6-svscanctl -6 /run/service
}
unexport !
cd /run/service
s6-svscan
''
|