runInLinuxImage
pkgs.vmTools.runInLinuxImage
Docs pulled from | This Revision | 29 minutes ago
Like runInLinuxVM, but run the build not using the stdenv from the Nix store, but using the tools provided by /bin, /usr/bin etc. from the specified filesystem image, which typically is a filesystem containing a non-NixOS Linux distribution.
Inputs
drv
-
1. Function argument
Noogle detected
Implementation
The following is the current implementation of this function.
runInLinuxImage =
drv:
runInLinuxVM (
lib.overrideDerivation drv (attrs: {
mountDisk = attrs.mountDisk or true;
/**
Mount `image' as the root FS, but use a temporary copy-on-write
image since we don't want to (and can't) write to `image'.
*/
preVM = ''
diskImage=$(pwd)/disk-image.qcow2
origImage=${attrs.diskImage}
if test -d "$origImage"; then origImage="$origImage/disk-image.qcow2"; fi
${qemu}/bin/qemu-img create -F ${attrs.diskImageFormat} -b "$origImage" -f qcow2 $diskImage
'';
/**
Inside the VM, run the stdenv setup script normally, but at the
very end set $PATH and $SHELL to the `native' paths for the
distribution inside the VM.
*/
postHook = ''
PATH=/usr/bin:/bin:/usr/sbin:/sbin
SHELL=/bin/sh
eval "$origPostHook"
'';
origPostHook = lib.optionalString (attrs ? postHook) attrs.postHook;
# Don't run Nix-specific build steps like patchelf.
fixupPhase = "true";
})
);