Skip to content

Commit 8a01034

Browse files
Mic92mergify[bot]
authored andcommitted
gcprotect our VM properly
I had an instance where toplevel was garbage collected while the VM was still running.
1 parent 7b5cdd9 commit 8a01034

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/nixos-shell

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ else
8080
)
8181
fi
8282

83-
nix run config.system.build.vm \
83+
TEMP_DIR=$(mktemp -d)
84+
trap 'rm -rf "$TEMP_DIR"' EXIT
85+
86+
nix build config.system.build.vm \
8487
--file "${script_dir}/../share/nixos-shell.nix" \
8588
--keep-going \
89+
--out-link "$TEMP_DIR/result" \
8690
"${extraBuildFlags[@]}" \
87-
"$@"
91+
"$TEMP_DIR/result/bin/run" "$@"

0 commit comments

Comments
 (0)