aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2022-11-13 04:55:01 +0100
committerpacien2022-11-13 04:55:01 +0100
commitc731b37a023b739158fcdebcfae10c3823c508a0 (patch)
tree61e88006ffb7dd1f94f5de761ffc016fb70533da
parent42923a5cf2cf6292aaf19eb1b550c6d20bd2a881 (diff)
downloadflaky-utils-c731b37a023b739158fcdebcfae10c3823c508a0.tar.gz
mkSandboxSystem: cleanup temp VM disk after exit
-rw-r--r--lib/mk-sandbox-system.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix
index c24ffa0..b2d85e2 100644
--- a/lib/mk-sandbox-system.nix
+++ b/lib/mk-sandbox-system.nix
@@ -44,7 +44,7 @@ rec {
44 44
45 virtualisation = { 45 virtualisation = {
46 graphics = lib.mkDefault false; 46 graphics = lib.mkDefault false;
47 diskImage = lib.mkDefault "$(mktemp).qcow2"; 47 diskImage = lib.mkDefault "$TMP_DISK";
48 48
49 sharedDirectories.host = { 49 sharedDirectories.host = {
50 source = "$SHARED_CWD"; 50 source = "$SHARED_CWD";
@@ -89,6 +89,10 @@ rec {
89 SHARED_CWD=$PWD 89 SHARED_CWD=$PWD
90 export SHARED_CWD 90 export SHARED_CWD
91 91
92 TMP_DISK="$(mktemp).qcow2"
93 export TMP_DISK
94 trap "rm -f \"$TMP_DISK\"" EXIT
95
92 ${packages.${name}}/bin/run-${name}-vm 96 ${packages.${name}}/bin/run-${name}-vm
93 97
94 reset 98 reset