From a6dbc4b689a0cad08350b03870a95e7c4889f330 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 1 Feb 2025 17:58:43 +0100 Subject: [PATCH 1/2] runInLinuxVM: fix simple build In 58570e75d9bddede2a854b0f7cb8df7f1818c541, I moved the PATH for coreutils *before* the sourcing of attrs + stdenv. However, AFAICT, this leads to PATH being overwritten and cat+chmod can't be found later on. We don't need to set PATH here at all, we can just do the same thing as in stage2Init - reference every coreutil explicitly. This keeps the environment the cleanest. Resolves #378545 --- pkgs/build-support/vm/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 25c89af32a4c..65687b72461f 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -237,10 +237,9 @@ rec { vmRunCommand = qemuCommand: writeText "vm-run" '' ${coreutils}/bin/mkdir xchg export > xchg/saved-env - PATH=${coreutils}/bin if [ -f "''${NIX_ATTRS_SH_FILE-}" ]; then - cp $NIX_ATTRS_JSON_FILE $NIX_ATTRS_SH_FILE xchg + ${coreutils}/bin/cp $NIX_ATTRS_JSON_FILE $NIX_ATTRS_SH_FILE xchg source "$NIX_ATTRS_SH_FILE" fi source $stdenv/setup @@ -258,7 +257,7 @@ rec { # Write the command to start the VM to a file so that the user can # debug inside the VM if the build fails (when Nix is called with # the -K option to preserve the temporary build directory). - cat > ./run-vm < ./run-vm < Date: Sun, 2 Feb 2025 20:12:49 +0100 Subject: [PATCH 2/2] nixos/lib/make-*-disk-zfs-image: fix build Those two helpers have not received the memo about a new requirement for virtiofs and about changes regarding the zfs related attributes. Can be tested with nix/release.nix' amazonImageZfs. --- nixos/lib/make-multi-disk-zfs-image.nix | 11 ++++++----- nixos/lib/make-single-disk-zfs-image.nix | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/nixos/lib/make-multi-disk-zfs-image.nix b/nixos/lib/make-multi-disk-zfs-image.nix index c4d6d69fae14..62937d50139c 100644 --- a/nixos/lib/make-multi-disk-zfs-image.nix +++ b/nixos/lib/make-multi-disk-zfs-image.nix @@ -123,10 +123,10 @@ let }; modulesTree = pkgs.aggregateModules ( - with config.boot.kernelPackages; + with config.boot; [ - kernel - zfs + kernelPackages.kernel + kernelPackages.${pkgs.zfs.kernelModuleAttribute} ] ); @@ -254,11 +254,12 @@ let image = (pkgs.vmTools.override { rootModules = [ - "zfs" "9p" "9pnet_virtio" - "virtio_pci" "virtio_blk" + "virtio_pci" + "virtiofs" + "zfs" ]; kernel = modulesTree; }).runInLinuxVM diff --git a/nixos/lib/make-single-disk-zfs-image.nix b/nixos/lib/make-single-disk-zfs-image.nix index 1641a7f799e2..b41a5d37b0aa 100644 --- a/nixos/lib/make-single-disk-zfs-image.nix +++ b/nixos/lib/make-single-disk-zfs-image.nix @@ -111,10 +111,10 @@ let }; modulesTree = pkgs.aggregateModules ( - with config.boot.kernelPackages; + with config.boot; [ - kernel - zfs + kernelPackages.kernel + kernelPackages.${pkgs.zfs.kernelModuleAttribute} ] ); @@ -242,11 +242,12 @@ let image = (pkgs.vmTools.override { rootModules = [ - "zfs" "9p" "9pnet_virtio" - "virtio_pci" "virtio_blk" + "virtio_pci" + "virtiofs" + "zfs" ]; kernel = modulesTree; }).runInLinuxVM