I was nerd sniped by @Enzime at nix.camp into implementing this, and here it is, over two months of painstaking work and reproducibility testing. See the README.md for more details of how it works, but the TL;DR is that it uses TCL Expect and Tesseract OCR together to automate the installation of archaic operating systems and boil them down to a single Nix command, or nixosModule.
The main attraction, I’m sure is going to be macOS, which you can enable from this flake with:
services.macos-ventura.enable = true
CI is implemented to run the macOS installer 10 times whenever it changes, catching any bugs and uploading a replay of what went wrong as screencaptures to IPFS. I’m tempted to increase that number to 100 and to start doing statistics, because VMs are tricky. But I’ve found it’s pretty reliable after 200~ runs without failure on various slow/fast hardware.
NixThePlanet introduces a few image builder functions such as makeDarwinImage and makeWin30Image which can be used like this for example:
I hope it’s OK to share some of my projects similar to this.
https://github.com/quyse/coil-toolchain-macos - macOS VM in Nix, with Xcode command line tools, which I’ve been using successfully for CI purposes, for building a macOS version of a C++ video game in a purely Nix pipeline on Linux. Uses startosinstall script as opposed to using GUI OS installer. Some metadata URL hashes are outdated, because with latest metadata the installation script breaks, and I don’t know yet how to fix it (and couldn’t get it working yet for Sonoma).
https://github.com/quyse/coil-toolchain-msvs - infra for installing many versions of MS Visual Studio, in Nix sandbox, to use in Windows VM or Wine. Again, used successfully for the CI purposes of a video game, including Xbox version which required particular version of MSVS.
Unfortunately my repos are not really documented, sorry, has been postponing writing some docs since forever - if anyone’s interested, I’ll write some.
@quyse, since @matthewcroughan and/or the contributors to nixtheplanet seem more inclined to document, maybe you can consider merging your projects into nixtheplanet.
I’ve been looking into startosinstall. I’m not 100% sure about it and I’d love to take everything I can get and put it into the repo, I’ve pinged @quyse on Matrix in case we can hack on it together.