From 26eba25577388072ba13b1682860fe872ba39942 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 24 Nov 2024 13:10:26 +0100 Subject: [PATCH] runInLinuxVM: re-add sourcing of stdenv & .attrs.sh This is required for `preVM` which can be arbitrary code: e.g. `vmTools.createEmptyImage` assumes the presence of `$out` in its default configuration. Also, before this patch, `preVM` wasn't even set in the `__structuredAttrs` case. --- pkgs/build-support/vm/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 648fea5cd016..8e262b20b3f6 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -240,6 +240,10 @@ rec { vmRunCommand = qemuCommand: writeText "vm-run" '' + if [ -f "''${NIX_ATTRS_SH_FILE-}" ]; then + source "$NIX_ATTRS_SH_FILE" + fi + source $stdenv/setup export > saved-env PATH=${coreutils}/bin