💾 Archived View for pixeldreams.tokyo › technomancy › vagrant-libvirt-slackware.gmi captured on 2024-09-29 at 00:01:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-12-28)

-=-=-=-=-=-=-

openbsd vm with vagrant on slackware 15.0

20 december, 2023

here is how i set up an openbsd vm for development under libvirt with vagrant

patching vagrant slackbuild

the version of vagrant on slackbuilds.org is old, and installing certain

plugins fails. the error is that installed ruby is "2.6.6" even though ruby -v

shows that 3.2.2 is installed, and that was very confusing...

i patched the .info and .SlackBuild of vagrant to install 2.4.0, and

installing plugins worked then

vagrant.info:

$ diff vagrant.info vagrant.info.sbopkg
2c2
< VERSION="2.2.15"
---
> VERSION="2.4.0"
4,7c4,7
< DOWNLOAD="https://releases.hashicorp.com/vagrant/2.2.15/vagrant_2.2.15_i686.rpm"
< MD5SUM="ae0d97049ecc03275b12eea6e92c6c91"
< DOWNLOAD_x86_64="https://releases.hashicorp.com/vagrant/2.2.15/vagrant_2.2.15_x86_64.rpm"
< MD5SUM_x86_64="68f7629a4fb363031cc95e00f4c17980"
---
> DOWNLOAD="https://releases.hashicorp.com/vagrant/2.4.0/vagrant-2.4.0-1.i686.rpm"
> MD5SUM="26af502b73619add0998190188aeaeb1"
> DOWNLOAD_x86_64="https://releases.hashicorp.com/vagrant/2.4.0/vagrant-2.4.0-1.x86_64.rpm"
> MD5SUM_x86_64="fa05adfdf8ba472a814ae71c69e9286c"

vagrant.SlackBuild:

$ diff vagrant.SlackBuild vagrant.SlackBuild.sbopkg
29c29
< VERSION=${VERSION:-2.2.15}
---
> VERSION=${VERSION:-2.4.0}
67c67
< rpm2cpio < $CWD/${PRGNAM}_${VERSION}_$SRCARCH.rpm | cpio -ivmd
---
> rpm2cpio < $CWD/${PRGNAM}-${VERSION}-${BUILD}.$SRCARCH.rpm | cpio -ivmd

plugins

then, i installed the plugins i need

vagrant plugin install vagrant-libvirt vagrant-scp

vagrantfile

and here is the vagrantfile for my dev vm:

$provision_script = <<-SCRIPT_EOF
set -x
echo -e "\e[95m[*] Applying syspatch\e[0m"
syspatch
echo -e "\e[95m[*] Upgrading existing packages\e[0m"
pkg_add -Uu
echo -e "\e[95m[*] Installing additional packages\e[0m"
pkg_add rust helix sshfs-fuse
echo -e "\e[95m[*] Configuring environment\e[0m"
echo 'permit nopass vagrant' > /etc/doas.conf
chsh -s /bin/ksh vagrant
cat <<-EOF >> /home/vagrant/.profile
export CARGO_TARGET_DIR='/home/vagrant/target' # so it isn't deleted by rsync
EOF
cat <<-EOF >> /home/vagrant/.kshrc
source ~/.profile
EOF
reboot
SCRIPT_EOF

Vagrant.configure("2") do |config|
  config.vm.box = "generic/openbsd7"
  config.vm.provision "shell", inline: $provision_script
  config.vm.synced_folder "~/Documents/Projects/", "/home/vagrant/pj",
    type: "rsync", rsync__args: ["-zz", "--delete", "--archive"]
end