Hi,
I’d like to contribute the little that I do to nixpkgs. I’m not a big fan of just pulling people’s code and running it locally with whatever access processes get when doing nix stuff, so I’d like to quickly spin a container or VM up with a checked out nixpkgs repo and configuration.nix to see and manually test the end-result of a PR.
Since there are PRs for graphical components, it’d be nice to be able to have an optional GUI for the container or VM.
So, before I go off on my own and write something that already exists: does anybody know of an existing tool (wheel, if you will)?
My current (cludgy) solution is a Vagrantfile and this directory layout
.
├── configuration.nix
├── nixpkgs
└── Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "griff/nixos-stable-x86_64"
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
vb.linked_clone = true
# Customize the amount of memory on the VM:
vb.memory = "8192"
vb.customize ["modifyvm", :id, "--vram", "128"]
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
end
config.vm.provision "shell", inline: <<-SHELL
sudo cp /vagrant/configuration.nix /etc/nixos/custom.nix
sudo nix-channel --add https://nixos.org/channels/nixos-22.05 nixos
sudo nix-env --delete-generations old
SHELL
config.vm.provision "shell", inline: "sudo nixos-rebuild -I /vagrant/nixpkgs switch"
end
It works, but /vagrant/nixpkgs is a somewhat slow mount, nix-channel --add might not be necessary, nix-env --delete-generations old doesn’t seem to do anything, there’s no declaration that vagrant and virtualbox are necessary… just doesn’t feel right yet. Maybe there isn’t much work left to do e.g add a shell.nix and a run.sh that starts vagrant and drops you into vagrant ssh, but yeah… if something already exists and there’s some tool people are already using (nixops?) that already does this, please do tell.
Addendum, it’d be great if PRs had a configuration.nix or test plan attached for reviewers.