MatthewCroughan / NixThePlanet

Run macOS, Windows and more via a single Nix command, or simple nixosModules
MIT License
534 stars 12 forks source link

makeDarwinImage: add option to not run the installer a second time #33

Closed Luflosi closed 1 week ago

Luflosi commented 1 month ago

Add an option createDiskImageIfNotExists which will prevent running the installer again and creating new copies of macOS in the Nix store whenever a dependency of NixThePlanet changes in Nixpkgs.

I override the Nixpkgs input on all my flake inputs so I don't have a dozen different copies of it. This causes the macOS installer to run almost every time I update, creating another version of the macOS base image. I don't need these extra copies, since I just keep the original install. Even when running the Nix garbage collector, I always have at least two macOS base images in my Nix store. One of them is referred to by the run script and the other one is referred to by the symlink in /var/lib/nixtheplanet-macos-ventura. This new option will allow me to never run the installer again and only have one version of macOS in my Nix store. If I ever delete the two files in /var/lib/nixtheplanet-macos-ventura, I can just enable this option again for a short amount of time until I have a new base image.

Luflosi commented 2 weeks ago

Could you please take another look?

MatthewCroughan commented 1 week ago

Sure, running this in CI now, will merge when it passes.

Luflosi commented 1 week ago

Awesome, thanks!