Last active
February 13, 2020 21:22
-
-
Save ilyaGotfryd/11dfc48812067ad7b361860a1a0692c6 to your computer and use it in GitHub Desktop.
Log sample when qemu worked fine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nixpkgs.overlays = [ | |
(self: super: { | |
open-vm-tools = super.open-vm-tools.overrideAttrs (oldAttrs: { | |
NIX_CFLAGS_COMPILE = [ "-DGLIB_DISABLE_DEPRECATION_WARNINGS" ]; | |
}); | |
qemu-flags = super.qemu-flags.qemuBinary.overrideAttrs (oldAttrs: { | |
x86_64-linux = "${super.qemuPkg}/bin/qemu-kvm -cpu Haswell"; | |
}); | |
}) | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 1.443732] Btrfs loaded, crc32c=crc32c-generic | |
[ 1.444664] Warning: unable to open an initial console. | |
[ 1.444719] This architecture does not have kernel memory protection. | |
[ 1.444765] Run /init as init process | |
[ 1.451925] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: | |
[ 1.727909] random: fast init done | |
[ 5.169186] random: crng init done | |
[ 25.532823] reboot: Restarting system | |
WARNING: Image format was not specified for 'nixos.raw' and probing guessed raw. | |
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. | |
Specify the 'raw' format explicitly to remove the restrictions. | |
qemu-system-x86_64: CPU model 'host' requires KVM | |
builder for '/nix/store/cz3pxdglzyfq6nf6mxd8hcpdck9x6m3v-nixos-disk-image.drv' failed with exit code 1 | |
error: build of '/nix/store/cz3pxdglzyfq6nf6mxd8hcpdck9x6m3v-nixos-disk-image.drv' failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-5.0# cat /nix/store/58l27cl4pks1v25c8q7yfpfq0hnzc1v6-nixpkgs-20.03pre194957.bef773ed53f/nixpkgs/nixos/lib/qemu-flags.nix | |
# QEMU flags shared between various Nix expressions. | |
{ pkgs }: | |
let | |
zeroPad = n: if n < 10 then "0${toString n}" else toString n; | |
in | |
{ | |
qemuNICFlags = nic: net: machine: | |
[ "-device virtio-net-pci,netdev=vlan${toString nic},mac=52:54:00:12:${zeroPad net}:${zeroPad machine}" | |
"-netdev vde,id=vlan${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}" | |
]; | |
qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0" | |
else if pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64 then "ttyAMA0" | |
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'"; | |
qemuBinary = qemuPkg: { | |
x86_64-linux = "${qemuPkg}/bin/qemu-kvm -cpu kvm64"; | |
armv7l-linux = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host"; | |
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host"; | |
x86_64-darwin = "${qemuPkg}/bin/qemu-kvm -cpu kvm64"; | |
}.${pkgs.stdenv.hostPlatform.system} or "${qemuPkg}/bin/qemu-kvm"; | |
} | |
bash-5.0# cat /nix/store/gv4m5kg1d7z5k1f5s3a3cr8158ng2kky-nixpkgs-20.03pre212770.cc1ae9f21b9/nixpkgs/nixos/lib/qemu-flags.nix | |
# QEMU flags shared between various Nix expressions. | |
{ pkgs }: | |
let | |
zeroPad = n: if n < 10 then "0${toString n}" else toString n; | |
in | |
{ | |
qemuNICFlags = nic: net: machine: | |
[ "-device virtio-net-pci,netdev=vlan${toString nic},mac=52:54:00:12:${zeroPad net}:${zeroPad machine}" | |
"-netdev vde,id=vlan${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}" | |
]; | |
qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0" | |
else if pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64 then "ttyAMA0" | |
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'"; | |
qemuBinary = qemuPkg: { | |
x86_64-linux = "${qemuPkg}/bin/qemu-kvm -cpu host"; | |
armv7l-linux = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host"; | |
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host"; | |
x86_64-darwin = "${qemuPkg}/bin/qemu-kvm -cpu host"; | |
}.${pkgs.stdenv.hostPlatform.system} or "${qemuPkg}/bin/qemu-kvm"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 1.493696] Warning: unable to open an initial console. | |
[ 1.493869] This architecture does not have kernel memory protection. | |
[ 1.494001] Run /init as init process | |
[ 1.499498] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: | |
[ 1.629859] random: fast init done | |
[ 4.277367] random: crng init done | |
[ 33.304903] reboot: Restarting system | |
WARNING: Image format was not specified for 'nixos.raw' and probing guessed raw. | |
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. | |
Specify the 'raw' format explicitly to remove the restrictions. | |
cSeaBIOS (version rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org) | |
iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+3FF91170+3FEF1170 C980 | |
Booting from ROM... | |
Probing EDD (edd=off to disable)... ocloading kernel modules... | |
insmod: can't insert '/nix/store/48ki3a4fxbzwikgs7wiblc65rj3vm17j-linux-4.19.80-shrunk/lib/modules/4.19.80/kernel/arch/x86/crypto/crc32c-intel.ko.xz': No such device | |
warning: unable to load /nix/store/48ki3a4fxbzwikgs7wiblc65rj3vm17j-linux-4.19.80-shrunk/lib/modules/4.19.80/kernel/arch/x86/crypto/crc32c-intel.ko.xz | |
mounting Nix store... | |
mounting host's temporary directory... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"/nix/store/cz3pxdglzyfq6nf6mxd8hcpdck9x6m3v-nixos-disk-image.drv": { | |
"outputs": { | |
"out": { | |
"path": "/nix/store/xiws5ppmd4s9fgmqmd2s0796kwwnyvdp-nixos-disk-image" | |
} | |
}, | |
"inputSrcs": [ | |
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh" | |
], | |
"inputDrvs": { | |
"/nix/store/19hd88hgggfdb2dhws048rm861x1fkh0-gnused-4.8.drv": [ | |
"out" | |
], | |
"/nix/store/34i71ckdlq0ixifqlj9m8a9k17g9x1b0-nixos-enter.drv": [ | |
"out" | |
], | |
"/nix/store/69f34rnhc4cznx463yfijmcnbsj2p320-xz-5.2.4.drv": [ | |
"bin" | |
], | |
"/nix/store/6kbvf0mk52nhiy4xr79q63670zpy2pks-coreutils-8.31.drv": [ | |
"out" | |
], | |
"/nix/store/7p71yyb0jw6b2rca76svayy3kaf2mkyr-qemu-4.2.0.drv": [ | |
"out" | |
], | |
"/nix/store/82ld38ywgl012nf28rsclm3wcjyz6mlj-diffutils-3.7.drv": [ | |
"out" | |
], | |
"/nix/store/anpw05frjnh3qd5sxy964hvic9im8hxy-stdenv-linux.drv": [ | |
"out" | |
], | |
"/nix/store/c715b9gbqn8dwks0i05rblbrayd404ch-gnutar-1.32.drv": [ | |
"out" | |
], | |
"/nix/store/cqrgfjx2lnn0pn87jnsblzxz7yz5s07q-gzip-1.10.drv": [ | |
"out" | |
], | |
"/nix/store/db2fp2lg9g73qgg3cw8xmjs5wcp7230r-bzip2-1.0.6.0.1.drv": [ | |
"bin" | |
], | |
"/nix/store/fkkrbgpnhfl81w79xiw9maj7rv9gqw8n-gawk-5.0.1.drv": [ | |
"out" | |
], | |
"/nix/store/fyplpj1fkqknzizrbb9pcdq6wfpx0q28-findutils-4.7.0.drv": [ | |
"out" | |
], | |
"/nix/store/gxisr1lsyvncrsk5x1w5cz40xjml9sff-nixos-20.03pre212770.cc1ae9f21b9.drv": [ | |
"out" | |
], | |
"/nix/store/gxmrilb2hkyzf95qsvalj17a72r776kb-util-linux-2.33.2.drv": [ | |
"bin", | |
"dev" | |
], | |
"/nix/store/n3jq8priw6jk4jphlfys77h50wjxsdxp-patch-2.7.6.drv": [ | |
"out" | |
], | |
"/nix/store/pnwr84k7jm7b5z5h6m6il1ihryf8hsnx-bash-4.4-p23.drv": [ | |
"out" | |
], | |
"/nix/store/pym9mp36dwh74k9msc673dak507f6hy3-closure-info.drv": [ | |
"out" | |
], | |
"/nix/store/rasd4h6nlqmqhkp03208dn81rrns6mqc-nixos-system-nixos-20.03pre212770.cc1ae9f21b9.drv": [ | |
"out" | |
], | |
"/nix/store/rcj831jmrily552n8ll9qs0hq6qql0g0-gnumake-4.2.1.drv": [ | |
"out" | |
], | |
"/nix/store/rj1hrrh3fvd3lmnnijwa2d6jvx3a8j18-nix-2.3.2.drv": [ | |
"out" | |
], | |
"/nix/store/rwvdzv7ginr5y8181x6f6xd45q4qkv8d-gnugrep-3.3.drv": [ | |
"out" | |
], | |
"/nix/store/s56fgi1wgkydgf5f80n6nx4v17higriq-vm-run.drv": [ | |
"out" | |
], | |
"/nix/store/vbk0hask343kcl3g2ja93y7pp6xmkwv5-e2fsprogs-1.45.5.drv": [ | |
"bin", | |
"dev" | |
], | |
"/nix/store/wplphp62njh6frqlsjddj3azqvjn1273-rsync-3.1.3.drv": [ | |
"out" | |
], | |
"/nix/store/wx48nd31x9dp5p022dcpq0c53va2v0pk-lkl-2019-10-04.drv": [ | |
"out" | |
], | |
"/nix/store/x3c4ydf4pfyljs1slnsr8ap63vj0k3i1-nixos-install.drv": [ | |
"out" | |
], | |
"/nix/store/x3krzl85r53w9hnin44z9dfywlvbrpc2-dosfstools-4.1.drv": [ | |
"out" | |
], | |
"/nix/store/zd130adhcr9vamdjm20m1jsd6dqpzn6s-parted-3.3.drv": [ | |
"out" | |
] | |
}, | |
"platform": "x86_64-linux", | |
"builder": "/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/sh", | |
"args": [ | |
"-e", | |
"/nix/store/7cf2ziyfwd7r4dpxy46mf8fpcblgscgk-vm-run" | |
], | |
"env": { | |
"QEMU_OPTS": " -m 1024", | |
"buildCommand": "export PATH=/nix/store/cyidim6g2z4dzfwg66njfhdsn67b73nj-rsync-3.1.3/bin:/nix/store/jv3my2ca8s3wch314cv09spc2sdablig-util-linux-2.33.2-bin/bin:/nix/store/0a71n047z9r346pbk7d1dxj8cl0b4j4m-parted-3.3/bin:/nix/store/nn910xxyxxy12n3z6sffmvps6v06j3pk-e2fsprogs-1.45.5-bin/bin:/nix/store/3jzkismh6glniajnbsag9qcmmwvxv3kr-lkl-2019-10-04/bin:/nix/store/sb1a479hrqlfsncz2chbprdjp58viypq-nixos-install/bin:/nix/store/yj5mw3w6ay592gr1b5vnj25wlzd9h9nc-nixos-enter/bin:/nix/store/c2r05785xa8w03vk7bkdshiszbd1cz7f-nix-2.3.2/bin:/nix/store/pabqc2cx3jrqijii1il528pd2by8ppg5-coreutils-8.31/bin:/nix/store/jx0bmnchjq89a2n9miaap7ypn4ybmlm9-findutils-4.7.0/bin:/nix/store/7b66wy0ng76jrcfb9i63kw55bcmriyyc-diffutils-3.7/bin:/nix/store/wfsn36mx0byajqn4vakyii8fbr3l4gd0-gnused-4.8/bin:/nix/store/lbnmcblsghqn8bpnf4bk9ps7bz24n813-gnugrep-3.3/bin:/nix/store/v4gxidpl04p8jc9jj4xsbvcf87483n8k-gawk-5.0.1/bin:/nix/store/dk9byimabz94964rixbc0zdm87ndb08w-gnutar-1.32/bin:/nix/store/7clq2a8mm9rw3qscp2pg64qc4vk8y718-gzip-1.10/bin:/nix/store/zk1s8dfn2c5b35lfj4baj370kmjj9shj-bzip2-1.0.6.0.1-bin/bin:/nix/store/lz9l40kxnf9jlwd3cg0kl5p7qy6rm791-gnumake-4.2.1/bin:/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin:/nix/store/zjmaf9rh7yr5yy3x6xzlia0yl869i1di-patch-2.7.6/bin:/nix/store/dys7lqqakyxj3bkrx162zlkirmzj3dwz-xz-5.2.4-bin/bin:$PATH\n\nrootDisk=/dev/vda1\n\n# Some tools assume these exist\nln -s vda /dev/xvda\nln -s vda /dev/sda\n\nmountPoint=/mnt\nmkdir $mountPoint\nmount $rootDisk $mountPoint\n\n# Create the ESP and mount it. Unlike e2fsprogs, mkfs.vfat doesn't support an\n# '-E offset=X' option, so we can't do this outside the VM.\n\n\n# Install a configuration.nix\nmkdir -p /mnt/etc/nixos\n\n\n# Set up core system link, GRUB, etc.\nNIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot\n\n# The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images\nrm -f $mountPoint/etc/machine-id\n\numount -R /mnt\n\n# Make sure resize2fs works. Note that resize2fs has stricter criteria for resizing than a normal\n# mount, so the `-c 0` and `-i 0` don't affect it. Setting it to `now` doesn't produce deterministic\n# output, of course, but we can fix that when/if we start making images deterministic.\ntune2fs -T now -c 0 -i 0 $rootDisk\n\n", | |
"buildInputs": "/nix/store/6vyh6q0hmskmybhjs0dkca6vbxasdlsp-util-linux-2.33.2-dev /nix/store/89j2gj6k489yflmwka8ypb4a2hcc77rl-e2fsprogs-1.45.5-dev /nix/store/rdgv2fpkqfs5zi92nd4c24w52xlmbydf-dosfstools-4.1", | |
"builder": "/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/sh", | |
"configureFlags": "", | |
"depsBuildBuild": "", | |
"depsBuildBuildPropagated": "", | |
"depsBuildTarget": "", | |
"depsBuildTargetPropagated": "", | |
"depsHostHost": "", | |
"depsHostHostPropagated": "", | |
"depsTargetTarget": "", | |
"depsTargetTargetPropagated": "", | |
"doCheck": "", | |
"doInstallCheck": "", | |
"memSize": "1024", | |
"name": "nixos-disk-image", | |
"nativeBuildInputs": "", | |
"origArgs": "-e /nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh", | |
"origBuilder": "/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/bash", | |
"out": "/nix/store/xiws5ppmd4s9fgmqmd2s0796kwwnyvdp-nixos-disk-image", | |
"outputs": "out", | |
"passAsFile": "", | |
"patches": "", | |
"postVM": "/nix/store/v2dqb9cabzrp3g4p33xj2k4d9dhj18si-qemu-4.2.0/bin/qemu-img convert -f raw -O qcow2 $diskImage $out/nixos.qcow2\n\ndiskImage=$out/nixos.qcow2\n\n", | |
"preVM": "export PATH=/nix/store/cyidim6g2z4dzfwg66njfhdsn67b73nj-rsync-3.1.3/bin:/nix/store/jv3my2ca8s3wch314cv09spc2sdablig-util-linux-2.33.2-bin/bin:/nix/store/0a71n047z9r346pbk7d1dxj8cl0b4j4m-parted-3.3/bin:/nix/store/nn910xxyxxy12n3z6sffmvps6v06j3pk-e2fsprogs-1.45.5-bin/bin:/nix/store/3jzkismh6glniajnbsag9qcmmwvxv3kr-lkl-2019-10-04/bin:/nix/store/sb1a479hrqlfsncz2chbprdjp58viypq-nixos-install/bin:/nix/store/yj5mw3w6ay592gr1b5vnj25wlzd9h9nc-nixos-enter/bin:/nix/store/c2r05785xa8w03vk7bkdshiszbd1cz7f-nix-2.3.2/bin:/nix/store/pabqc2cx3jrqijii1il528pd2by8ppg5-coreutils-8.31/bin:/nix/store/jx0bmnchjq89a2n9miaap7ypn4ybmlm9-findutils-4.7.0/bin:/nix/store/7b66wy0ng76jrcfb9i63kw55bcmriyyc-diffutils-3.7/bin:/nix/store/wfsn36mx0byajqn4vakyii8fbr3l4gd0-gnused-4.8/bin:/nix/store/lbnmcblsghqn8bpnf4bk9ps7bz24n813-gnugrep-3.3/bin:/nix/store/v4gxidpl04p8jc9jj4xsbvcf87483n8k-gawk-5.0.1/bin:/nix/store/dk9byimabz94964rixbc0zdm87ndb08w-gnutar-1.32/bin:/nix/store/7clq2a8mm9rw3qscp2pg64qc4vk8y718-gzip-1.10/bin:/nix/store/zk1s8dfn2c5b35lfj4baj370kmjj9shj-bzip2-1.0.6.0.1-bin/bin:/nix/store/lz9l40kxnf9jlwd3cg0kl5p7qy6rm791-gnumake-4.2.1/bin:/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin:/nix/store/zjmaf9rh7yr5yy3x6xzlia0yl869i1di-patch-2.7.6/bin:/nix/store/dys7lqqakyxj3bkrx162zlkirmzj3dwz-xz-5.2.4-bin/bin\n\n# Yes, mkfs.ext4 takes different units in different contexts. Fun.\nsectorsToKilobytes() {\n echo $(( ( \"$1\" * 512 ) / 1024 ))\n}\n\nsectorsToBytes() {\n echo $(( \"$1\" * 512 ))\n}\n\nmkdir $out\ndiskImage=nixos.raw\ntruncate -s 8192M $diskImage\n\nparted --script $diskImage -- \\\n mklabel msdos \\\n mkpart primary ext4 1MiB -1\n\n\n# Get start & length of the root partition in sectors to $START and $SECTORS.\neval $(partx $diskImage -o START,SECTORS --nr 1 --pairs)\n\nmkfs.ext4 -F -L nixos $diskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K\n\n\nroot=\"$PWD/root\"\nmkdir -p $root\n\n# Copy arbitrary other files into the image\n# Semi-shamelessly copied from make-etc.sh. I (@copumpkin) shall factor this stuff out as part of\n# https://github.com/NixOS/nixpkgs/issues/23052.\nset -f\nsources_=()\ntargets_=()\nset +f\n\nfor ((i = 0; i < ${#targets_[@]}; i++)); do\n source=\"${sources_[$i]}\"\n target=\"${targets_[$i]}\"\n\n if [[ \"$source\" =~ '*' ]]; then\n # If the source name contains '*', perform globbing.\n mkdir -p $root/$target\n for fn in $source; do\n rsync -a --no-o --no-g \"$fn\" $root/$target/\n done\n else\n mkdir -p $root/$(dirname $target)\n if ! [ -e $root/$target ]; then\n rsync -a --no-o --no-g $source $root/$target\n else\n echo \"duplicate entry $target -> $source\"\n exit 1\n fi\n fi\ndone\n\nexport HOME=$TMPDIR\n\n# Provide a Nix database so that nixos-install can copy closures.\nexport NIX_STATE_DIR=$TMPDIR/state\nnix-store --load-db < /nix/store/s5930zksqqwx23sica99pfx09y06z8p5-closure-info/registration\n\necho \"running nixos-install...\"\nnixos-install --root $root --no-bootloader --no-root-passwd \\\n --system /nix/store/0qbamc6ipd4ahn3wixpksv736vpfw852-nixos-system-nixos-20.03pre212770.cc1ae9f21b9 --channel /nix/store/s4jdi2ipzqvdcwlpj8c0ig6v7a2fmmd8-nixos-20.03pre212770.cc1ae9f21b9 --substituters \"\"\n\necho \"copying staging root to image...\"\ncptofs -p -P 1 -t ext4 -i $diskImage $root/* /\n", | |
"propagatedBuildInputs": "", | |
"propagatedNativeBuildInputs": "", | |
"requiredSystemFeatures": "kvm", | |
"stdenv": "/nix/store/bmz62p8m3vnam7qkiz66yrqdiv1ihph2-stdenv-linux", | |
"strictDeps": "", | |
"system": "x86_64-linux" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Derive([("out","/nix/store/7cf2ziyfwd7r4dpxy46mf8fpcblgscgk-vm-run","","")],[("/nix/store/6kbvf0mk52nhiy4xr79q63670zpy2pks-coreutils-8.31.drv",["out"]),("/nix/store/6kv4cdray47l7x56zqx7g5rmn9brzhy9-qemu-host-cpu-only-4.2.0.drv",["out"]),("/nix/store/anpw05frjnh3qd5sxy964hvic9im8hxy-stdenv-linux.drv",["out"]),("/nix/store/h8crgazcbywkji20pfjkvlsh9mhhjgsw-linux-5.4.18.drv",["out"]),("/nix/store/pnwr84k7jm7b5z5h6m6il1ihryf8hsnx-bash-4.4-p23.drv",["out"]),("/nix/store/rajwc6afrm9v3485310r5m6vsf21mv20-initrd.drv",["out"]),("/nix/store/zg8s1yzzwi9zikp3dcvk2ygrlc5dz42z-vm-run-stage2.drv",["out"])],["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],"x86_64-linux","/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("allowSubstitutes",""),("buildCommand","n=$out | |
mkdir -p "$(dirname "$n")" | |
if [ -e "$textPath" ]; then | |
mv "$textPath" "$n" | |
else | |
echo -n "$text" > "$n" | |
fi | |
(test -n "$executable" && chmod +x "$n") || true | |
"),("buildInputs",""),("builder","/nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/bash"),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck",""),("doInstallCheck",""),("executable",""),("name","vm-run"),("nativeBuildInputs",""),("out","/nix/store/7cf2ziyfwd7r4dpxy46mf8fpcblgscgk-vm-run"),("outputs","out"),("passAsFile","text"),("patches",""),("preferLocalBuild","1"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("stdenv","/nix/store/bmz62p8m3vnam7qkiz66yrqdiv1ihph2-stdenv-linux"),("strictDeps",""),("system","x86_64-linux"),("text","export > saved-env | |
PATH=/nix/store/pabqc2cx3jrqijii1il528pd2by8ppg5-coreutils-8.31/bin | |
mkdir xchg | |
mv saved-env xchg/ | |
eval "$preVM" | |
if [ "$enableParallelBuilding" = 1 ]; then | |
if [ ${NIX_BUILD_CORES:-0} = 0 ]; then | |
QEMU_OPTS+=" -smp cpus=$(nproc)" | |
else | |
QEMU_OPTS+=" -smp cpus=$NIX_BUILD_CORES" | |
fi | |
fi | |
# 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 <<EOF | |
#! /nix/store/r6z3c7dwdxw4jjdg1l8nqwxm83j4gll8-bash-4.4-p23/bin/sh | |
${diskImage:+diskImage=$diskImage} | |
TMPDIR=$TMPDIR | |
cd $TMPDIR | |
/nix/store/ya55f40ym34x3x31vaa9znrhrqcq9ksg-qemu-host-cpu-only-4.2.0/bin/qemu-kvm -cpu host \ | |
-nographic -no-reboot \ | |
-device virtio-rng-pci \ | |
-virtfs local,path=/nix/store,security_model=none,mount_tag=store \ | |
-virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \ | |
${diskImage:+-drive file=$diskImage,if=virtio,cache=unsafe,werror=report} \ | |
-kernel /nix/store/ghhpw8s3wlrvdg2kyp25s098nas5fvwy-linux-5.4.18/bzImage \ | |
-initrd /nix/store/i9hfvdc5npr8bqxm5f4ppx50498az70r-initrd/initrd \ | |
-append "console=ttyS0 panic=1 command=/nix/store/6pnzga8zl9f6c2rfz5fm4rbbnibasym4-vm-run-stage2 out=$out mountDisk=$mountDisk loglevel=4" \ | |
$QEMU_OPTS | |
EOF | |
mkdir -p -m 0700 $out | |
chmod +x ./run-vm | |
source ./run-vm | |
if ! test -e xchg/in-vm-exit; then | |
echo "Virtual machine didn't produce an exit code." | |
exit 1 | |
fi | |
exitCode="$(cat xchg/in-vm-exit)" | |
if [ "$exitCode" != "0" ]; then | |
exit "$exitCode" | |
fi | |
eval "$postVM" | |
")]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment