From c731b37a023b739158fcdebcfae10c3823c508a0 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 13 Nov 2022 04:55:01 +0100 Subject: mkSandboxSystem: cleanup temp VM disk after exit --- lib/mk-sandbox-system.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') 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 { virtualisation = { graphics = lib.mkDefault false; - diskImage = lib.mkDefault "$(mktemp).qcow2"; + diskImage = lib.mkDefault "$TMP_DISK"; sharedDirectories.host = { source = "$SHARED_CWD"; @@ -89,6 +89,10 @@ rec { SHARED_CWD=$PWD export SHARED_CWD + TMP_DISK="$(mktemp).qcow2" + export TMP_DISK + trap "rm -f \"$TMP_DISK\"" EXIT + ${packages.${name}}/bin/run-${name}-vm reset -- cgit v1.2.3