File tree Expand file tree Collapse file tree 7 files changed +20
-35
lines changed Expand file tree Collapse file tree 7 files changed +20
-35
lines changed Original file line number Diff line number Diff line change 64
64
environment.systemPackages = [ (
65
65
# Provide a manual updating script that fetches the latest
66
66
# updated+built system from Hydra
67
- pkgs.writeScriptBin "update-microvm" ''
68
- #! ${pkgs.runtimeShell} -e
69
-
67
+ pkgs.writeShellScriptBin "update-microvm" ''
70
68
if [ $# -lt 1 ]; then
71
69
NAMES="$(ls -1 /var/lib/microvms)"
72
70
else
Original file line number Diff line number Diff line change 4
4
} :
5
5
6
6
let
7
- inherit ( pkgs ) lib writeScriptBin ;
7
+ inherit ( pkgs ) lib ;
8
8
9
9
inherit ( import ./. { nixpkgs-lib = lib ; } ) createVolumesScript makeMacvtap ;
10
10
inherit ( makeMacvtap {
23
23
execArg = lib . optionalString microvmConfig . prettyProcnames
24
24
''-a "microvm@${ microvmConfig . hostName } "'' ;
25
25
26
- runScriptBin = pkgs . buildPackages . writeScriptBin "microvm-run" ''
27
- #! ${ pkgs . runtimeShell } -e
28
-
26
+ runScriptBin = pkgs . buildPackages . writeShellScriptBin "microvm-run" ''
29
27
${ preStart }
30
28
${ createVolumesScript pkgs . buildPackages microvmConfig . volumes }
31
29
${ lib . optionalString ( hypervisorConfig . requiresMacvtapAsFds or false ) openMacvtapFds }
32
30
33
31
exec ${ execArg } ${ command }
34
32
'' ;
35
33
36
- shutdownScriptBin = pkgs . buildPackages . writeScriptBin "microvm-shutdown" ''
37
- #! ${ pkgs . runtimeShell } -e
38
-
34
+ shutdownScriptBin = pkgs . buildPackages . writeShellScriptBin "microvm-shutdown" ''
39
35
${ shutdownCommand }
40
36
'' ;
41
37
42
- balloonScriptBin = pkgs . buildPackages . writeScriptBin "microvm-balloon" ''
43
- #! ${ pkgs . runtimeShell } -e
38
+ balloonScriptBin = pkgs . buildPackages . writeShellScriptBin "microvm-balloon" ''
39
+ set -e
44
40
45
41
if [ -z "$1" ]; then
46
42
echo "Usage: $0 <balloon-size-mb>"
Original file line number Diff line number Diff line change 137
137
RemainAfterExit = true ;
138
138
ExecStop =
139
139
let
140
- stopScript = pkgs . writeScript "stop-microvm-tap-interfaces" ''
141
- #! ${ pkgs . runtimeShell } -e
142
-
140
+ stopScript = pkgs . writeShellScript "stop-microvm-tap-interfaces" ''
143
141
cd ${ stateDir } /$1
144
142
for id in $(cat current/share/microvm/tap-interfaces); do
145
143
${ pkgs . iproute2 } /bin/ip tuntap del name $id mode tap
176
174
RemainAfterExit = true ;
177
175
ExecStop =
178
176
let
179
- stopScript = pkgs . writeScript "stop-microvm-tap-interfaces" ''
180
- #! ${ pkgs . runtimeShell } -e
177
+ stopScript = pkgs . writeShellScript "stop-microvm-tap-interfaces" ''
181
178
cd ${ stateDir } /$1
182
179
cat current/share/microvm/macvtap-interfaces | while read -r line;do
183
180
opts=( $line )
Original file line number Diff line number Diff line change 2
2
3
3
let
4
4
# TODO: did not get sommelier to work
5
- run-sommelier = with pkgs ; writeScriptBin "run-sommelier" ''
6
- #!${ runtimeShell } -e
7
- exec ${ sommelier } /bin/sommelier --virtgpu-channel -- $@
5
+ run-sommelier = with pkgs ; writeShellScriptBin "run-sommelier" ''
6
+ exec ${ lib . getExe sommelier } --virtgpu-channel -- $@
8
7
'' ;
9
8
# Working: run Wayland applications prefixed with `run-wayland-proxy`
10
- run-wayland-proxy = with pkgs ; writeScriptBin "run-wayland-proxy" ''
11
- #!${ runtimeShell } -e
12
- exec ${ wayland-proxy-virtwl } /bin/wayland-proxy-virtwl --virtio-gpu -- $@
9
+ run-wayland-proxy = with pkgs ; writeShellScriptBin "run-wayland-proxy" ''
10
+ exec ${ lib . getExe wayland-proxy-virtwl } --virtio-gpu -- $@
13
11
'' ;
14
12
# Waypipe. Needs `microvm#waypipe-client` on the host.
15
- run-waypipe = with pkgs ; writeScriptBin "run-waypipe" ''
16
- #!${ runtimeShell } -e
17
- exec ${ waypipe } /bin/waypipe --vsock -s 2:6000 server $@
13
+ run-waypipe = with pkgs ; writeShellScriptBin "run-waypipe" ''
14
+ exec ${ lib . getExe waypipe } /bin/waypipe --vsock -s 2:6000 server $@
18
15
'' ;
19
16
in
20
17
lib . mkIf config . microvm . graphics . enable {
Original file line number Diff line number Diff line change 94
94
95
95
# Implementations
96
96
config . microvm . deploy = {
97
- installOnHost = pkgs . writeScriptBin "microvm-install-on-host" ''
97
+ installOnHost = pkgs . writeShellScriptBin "microvm-install-on-host" ''
98
98
set -eou pipefail
99
99
100
100
HOST="$1"
157
157
'' ;
158
158
159
159
sshSwitch = lib . mkIf canSwitchViaSsh (
160
- pkgs . writeScriptBin "microvm-switch" ''
160
+ pkgs . writeShellScriptBin "microvm-switch" ''
161
161
set -eou pipefail
162
162
163
163
TARGET="$1"
186
186
''
187
187
) ;
188
188
189
- rebuild = with config . microvm . deploy ; pkgs . writeScriptBin "microvm-rebuild" ''
189
+ rebuild = with config . microvm . deploy ; pkgs . writeShellScriptBin "microvm-rebuild" ''
190
190
set -eou pipefail
191
191
192
192
HOST="$1"
Original file line number Diff line number Diff line change 2
2
# local pkgs not from the target flake.
3
3
{ self
4
4
, lib , targetPlatform
5
- , writeScriptBin , runtimeShell
5
+ , writeShellScriptBin
6
6
, coreutils , git , nix
7
7
} :
8
8
9
- writeScriptBin "build-microvm" ''
10
- #! ${ runtimeShell } -e
11
-
9
+ writeShellScriptBin "build-microvm" ''
12
10
PATH=${ lib . makeBinPath [ coreutils git nix ] }
13
11
14
12
if [ $# -lt 1 ]; then
Original file line number Diff line number Diff line change 14
14
} ;
15
15
colored = color : text : "${ colors . ${ color } } ${ text } ${ colors . normal } " ;
16
16
in
17
- writeScriptBin "microvm" ''
18
- #! ${ pkgs . runtimeShell }
17
+ writeShellScriptBin "microvm" ''
19
18
set -e
20
19
21
20
PATH=${ lib . makeBinPath [
You can’t perform that action at this time.
0 commit comments