[Bio-packaging] Sharing GNU guix with VMs (in this case KVM)

Pjotr Prins pjotr.public66 at thebird.nl
Tue Oct 13 13:14:08 UTC 2015


Just wanted to share the following:

This is my setup for sharing GUIX from the host with running VMs. GUIX
can be mounted read-only and it is similar to Ricardo's setup on an
HPC compute cluster: http://elephly.net/posts/2015-04-17-gnu-guix.html

On Linux (here Debian Wheezy-backports with a 3.16 Linux kernel) sharing
Guix with host and KVM, start up the VM with something like

  qemu-system-x86_64 -enable-kvm -hda hda.img \
    -m 1024M \
    -smp 2 \
    -redir tcp:2222::22 \
    -fsdev local,security_model=passthrough,id=fsdev0,path=/gnu \
    -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=gnu \
    -fsdev local,security_model=passthrough,id=fsdev1,path=/var/guix \
    -device virtio-9p-pci,id=fs1,fsdev=fsdev1,mount_tag=guix 

Mount guix directories inside KVM

  ssh -p 2222 localhost

as root:

  mkdir /gnu
  mkdir /var/guix
  mount -t 9p -o trans=virtio,version=9p2000.L gnu /gnu
  mount -t 9p -o trans=virtio,version=9p2000.L guix /var/guix

Now we have GNU Guix visible. Create the root profile - which will
match that on the host

  ln -sf /var/guix/profiles/per-user/root/guix-profile \
         /root/.guix-profile

The same for other users that need to access a profile, e.g., as a
user

  ln -sf /var/guix/profiles/per-user/$USER/guix-profile \
         $HOME/.guix-profile

The only catch (really) is that all software has to be installed on
the host (which has a running guix-daemon) and VM users need to have a
matching host profile.

A similar exercise can be done with Docker. When I get round to that
I'll post it here (we had it working in Japan during the
biohackathon).

Pj.



More information about the bio-packaging mailing list