Subject: [PATCH 00/32] Add vagrant, some vagrant plugins and required ruby modules

From: Hartmut Goebel <[email-masked]>
Date: Mon, 7 Aug 2023 20:24:03 +0200

This series add Vagrant, a utility for managing the lifecycle of virtual
machines, and some (non-) trivial plugins for it, as well as the required
packages.

This series contains some plugins (esp. vagrant-libvirt) to test whether
vagrant's plugins-mechanism actually works in Guix. (And indeed, quite some
adjustments had to be made to vagrant make this work.)

Using this setup I was able to

- install plugins (per-user=global and per-project=local)
- show list of system plugins
- search for boxes (vargant cloud search)
- download a box (done by vagrant up)
- list downloaded boxes (vagrant box list)
- start a virtual machine using libvirt (vagrant up)
- added an unidirectional synced folders using rsync
- added a bidirectional synced folders using 9p virtfs
- copy data into the machine using "vagrant scp"
- reload, stop and destroy the box

Not working for me:

- synced folders using virtiofs: 'requires shared memory — this might be
  caused by my local setup or missing stuff in Vagrantfile

Here is the code I used for testing:

...8<----
./pre-inst-env guix shell \
  -C openssh coreutils rsync \
  --network --share=/tmp --expose=/var/run/libvirt \
  vagrant vagrant-vai vagrant-cachier vagrant-reload vagrant-libvirt nss-certs

the in the shell:

export SSL_CERT_DIR=$GUIX_ENVIRONMENT/etc/ssl/certs
export VAGRANT_DEFAULT_PROVIDER=libvirt
mkdir -p /tmp/vagrant-test/xxx/
cd /tmp/vagrant-test/
HOME=$PWD
cd xxx
cat > Vagrantfile <<EOF
Vagrant.configure("2") do |config|
  config.vm.box = "generic/alpine317"  # reasonable small
  config.vm.synced_folder "a", "/vagrant/rsynced", type: "rsync"
  #config.vm.synced_folder "b", "/vagrant/9p", type: "9p"
  #config.vm.synced_folder "c", "/vagrant/virtio", type: "virtio"
  # for testing vagrant-vai
  config.vm.provision :vai do |ansible|
    ansible.inventory_dir = 'ansible/inventory'
  end
end
EOF
rm -rf {a,b,c}
mkdir {a,b,c}

# test plugin management
vagrant plugin list
vagrant plugin install vagrant-scp
vagrant plugin install --local vagrant-timezone
vagrant plugin list --local
plugin uninstall vagrant-timezone --local
vagrant plugin list --local

# test download of box and starting machine
touch a/file-from-A.txt
vagrant up

# test plugin vagrant-scp
vagrant scp Vagrantfile default:xxx.txt
vagrant ssh -c 'ls'

# test file-sync  - you need to enable different options in the Vagrantfile
# to test them an. then run 'vagrant reload'
touch a/file-from-A.txt
vagrant reload  # to trigger rsync
touch b/file-from-B.txt c/file-from-C.txt
vagrant ssh -c 'touch /vagrant/9p/file-from-9p.txt'
vagrant ssh -c 'touch /vagrant/rsynced/file-from-rsynced.txt'
vagrant ssh -c 'touch /vagrant/virtio/file-from-virtio.txt'
vagrant ssh -c 'ls -F /vagrant/*/'
ls {a,b,c}

vagrant destroy -f
...8<----

Hartmut Goebel (32):
  gnu: Add ruby-excon.
  gnu: Add ruby-ipaddr.
  gnu: Add ruby-net-ftp.
  gnu: Add ruby-fake-ftp.
  gnu: Add ruby-net-sftp.
  gnu: Add ruby-net-telnet.
  gnu: Add ruby-pairing-heap.
  gnu: Add ruby-stringio.
  gnu: Add ruby-stream.
  gnu: Add ruby-rgl.
  gnu: Add ruby-sfl.
  gnu: Add ruby-specinfra.
  gnu: Add ruby-serverspec.
  gnu: Add ruby-time.
  gnu: Add ruby-google-protobuf.
  gnu: Add ruby-googleapis-common-protos-types.
  gnu: Add ruby-grpc.
  gnu: Add ruby-vagrant-cloud.
  gnu: Add ruby-vagrant-spec.
  gnu: Add ruby-vagrant-spec-helper-basic.
  gnu: Add ruby-hashicorp-checkpoint.
  gnu: ruby-childprocess: Update to 4.1.0.
  gnu: Add vagrant.
  gnu: Add vagrant-vai.
  gnu: Add vagrant-cachier.
  gnu: Add vagrant-reload.
  gnu: Add ruby-libvirt.
  gnu: Add ruby-fog-core.
  gnu: Add ruby-fog-json.
  gnu: Add ruby-fog-xml.
  gnu: Add ruby-fog-libvirt.
  gnu: Add vagrant-libvirt.

 gnu/local.mk                                  |   3 +
 ...ant-Support-system-installed-plugins.patch | 172 +++++
 .../vagrant-Use-a-private-temporary-dir.patch | 119 ++++
 ...rant-silence-warning-about-installer.patch |  24 +
 gnu/packages/ruby.scm                         | 621 +++++++++++++++++-
 gnu/packages/virtualization.scm               | 363 ++++++++++
 6 files changed, 1296 insertions(+), 6 deletions(-)
 create mode 100644 gnu/packages/patches/vagrant-Support-system-installed-plugins.patch
 create mode 100644 gnu/packages/patches/vagrant-Use-a-private-temporary-dir.patch
 create mode 100644 gnu/packages/patches/vagrant-bin-vagrant-silence-warning-about-installer.patch

base-commit: 39fbc041f92489ec30075a85937c8a38723752dc
-- 
2.30.9