guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sharing GNU guix with VMs (in this case KVM)


From: Pjotr Prins
Subject: Sharing GNU guix with VMs (in this case KVM)
Date: Tue, 13 Oct 2015 15:10:02 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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

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.

Pj.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]