diff options
author | Allen Nelson <anelson@narrativescience.com> | 2016-09-27 23:42:05 +0000 |
---|---|---|
committer | Allen Nelson <anelson@narrativescience.com> | 2016-09-29 12:52:57 -0500 |
commit | 4abe579250242512973f3e32ae7560a7dd3b9656 (patch) | |
tree | 5f3c12901cb544a28593466668120ff9162a6dd4 /pkgs/build-support/vm/default.nix | |
parent | 58dc2f9d491079fe3f7e7dbe11da3167cd96e8d6 (diff) | |
download | nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar.gz nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar.bz2 nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar.lz nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar.xz nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.tar.zst nixlib-4abe579250242512973f3e32ae7560a7dd3b9656.zip |
add docs to docker build functions
bring back ls_tar replace goPackages with go don't hardcode /nix/store in vmTools more docs
Diffstat (limited to 'pkgs/build-support/vm/default.nix')
-rw-r--r-- | pkgs/build-support/vm/default.nix | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 245d0bebb45d..f96416b288f1 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -1,6 +1,7 @@ { pkgs , kernel ? pkgs.linux , img ? "bzImage" +, storeDir ? builtins.storeDir , rootModules ? [ "virtio_pci" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "rtc_cmos" ] }: @@ -128,8 +129,8 @@ rec { mount -t devpts none /fs/dev/pts echo "mounting Nix store..." - mkdir -p /fs/nix/store - mount -t 9p store /fs/nix/store -o trans=virtio,version=9p2000.L,cache=loose + mkdir -p /fs${storeDir} + mount -t 9p store /fs${storeDir} -o trans=virtio,version=9p2000.L,cache=loose mkdir -p /fs/tmp /fs/run /fs/var mount -t tmpfs -o "mode=1777" none /fs/tmp @@ -172,7 +173,7 @@ rec { # apparent KVM > 1.5.2 bug. ${pkgs.utillinux}/bin/hwclock -s - export NIX_STORE=/nix/store + export NIX_STORE=${storeDir} export NIX_BUILD_TOP=/tmp export TMPDIR=/tmp export PATH=/empty @@ -220,7 +221,7 @@ rec { ${lib.optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \ -nographic -no-reboot \ -device virtio-rng-pci \ - -virtfs local,path=/nix/store,security_model=none,mount_tag=store \ + -virtfs local,path=${storeDir},security_model=none,mount_tag=store \ -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \ -drive file=$diskImage,if=virtio,cache=unsafe,werror=report \ -kernel ${kernel}/${img} \ @@ -298,7 +299,7 @@ rec { /* Run a derivation in a Linux virtual machine (using Qemu/KVM). By default, there is no disk image; the root filesystem is a tmpfs, - and /nix/store is shared with the host (via the 9P protocol). + and the nix store is shared with the host (via the 9P protocol). Thus, any pure Nix derivation should run unmodified, e.g. the call @@ -434,8 +435,8 @@ rec { chroot=$(type -tP chroot) # Make the Nix store available in /mnt, because that's where the RPMs live. - mkdir -p /mnt/nix/store - ${utillinux}/bin/mount -o bind /nix/store /mnt/nix/store + mkdir -p /mnt${storeDir} + ${utillinux}/bin/mount -o bind ${storeDir} /mnt${storeDir} # Newer distributions like Fedora 18 require /lib etc. to be # symlinked to /usr. @@ -474,7 +475,7 @@ rec { rm /mnt/.debug - ${utillinux}/bin/umount /mnt/nix/store /mnt/tmp ${lib.optionalString unifiedSystemDir "/mnt/proc"} + ${utillinux}/bin/umount /mnt${storeDir} /mnt/tmp ${lib.optionalString unifiedSystemDir "/mnt/proc"} ${utillinux}/bin/umount /mnt ''; @@ -605,8 +606,8 @@ rec { done # Make the Nix store available in /mnt, because that's where the .debs live. - mkdir -p /mnt/inst/nix/store - ${utillinux}/bin/mount -o bind /nix/store /mnt/inst/nix/store + mkdir -p /mnt/inst${storeDir} + ${utillinux}/bin/mount -o bind ${storeDir} /mnt/inst${storeDir} ${utillinux}/bin/mount -o bind /proc /mnt/proc ${utillinux}/bin/mount -o bind /dev /mnt/dev @@ -654,7 +655,7 @@ rec { rm /mnt/.debug - ${utillinux}/bin/umount /mnt/inst/nix/store + ${utillinux}/bin/umount /mnt/inst${storeDir} ${utillinux}/bin/umount /mnt/proc ${utillinux}/bin/umount /mnt/dev ${utillinux}/bin/umount /mnt |