Closed fillon closed 8 months ago
It is documented in the README.md how to use the makeDarwinImage
function, and there is a package
option for the macos-ventura
module. So if you're familiar with NixOS you should be able to figure out how to use this to set the disk size.
services.macos-ventura = {
enable = true;
package = pkgs.makeDarwinImage { diskSizeBytes = 60000000000; };
};
This will incur a full rebuild of the base disk image. I would like to figure out a way of expanding this that doesn't involve a full rebuild of the disk image, by creating a second image that will ssh
into the VM and perform resize operations. I will implement this in the future.
Actually, that won't work currently, but I'm testing a fix that makes that work here, whilst also adding a test for it to make sure it keeps working.
https://github.com/MatthewCroughan/NixThePlanet/commit/bda55ba4bdfddc7aea0422427031be7194d05764
You can see the CI running for it here https://hercules-ci.com/github/MatthewCroughan/NixThePlanet/jobs/343
Thanks :) I was trying to figure out what I was doing wrong.
Down the track, how would you a force rebuild of the vm? I could not find where the ./macos-ventura.qcow2 is located. Lost of black magic, just 3 months into nix so still in learning phase. But greatly impressed by the possibilities.
There's no black magic here, it just puts the qcow2 image into the dataDir
option which defaults to /var/lib/nixtheplanet-macos-ventura
that's what i have . no qcow2 file there
ls -als /var/lib/nixtheplanet-macos-ventura
/var/lib/nixtheplanet-macos-ventura -> private/nixtheplanet-macos-ventura
It's a symlink to private/nixtheplanet-macos-ventura
which you're not looking in.
got it.. feeling dumb now
No problem, it can be confusing. The reason it's a symlink into private
is because of the systemd DynamicUser option
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#DynamicUser=
This means the VM is launched in QEMU with a random UID every single time, and systemd chowns the file to the QEMU process each time the service is launched.
It's a symlink to
private/nixtheplanet-macos-ventura
which you're not looking in.
How do I go about removing trace of this VM including the created stuff in private/nixtheplanet-macos-ventura ?
@rastarr
rm -rf /var/lib/nixtheplanet-macos-ventura
rm -rf /var/lib/private/nixtheplanet-macos-ventura
nix-collect-garbage
TL;DR, the macOS base image is 40G and lives in the /nix/store
, removing it is able to be done like shown above, or by manual deletion via nix store delete
.
Note, nix-collect-garbage
will garbage collect other things on the system automatically, which includes the stuff we just removed, as it is no longer referenced thanks to the rm
of the symlinks. If you don't want that then you should nix store delete
the macOS base image that was created manually, which is a symlink to the nix store that you can see in /var/lib/private/nixtheplanet-macos-ventura
yourself with ls -lah
.
Thanks heaps for the fast reply Matthew I'll check this repo out a bit later if it's needed. Great work on it as well, appreciated
@rastarr
rm -rf /var/lib/nixtheplanet-macos-ventura rm -rf /var/lib/private/nixtheplanet-macos-ventura nix-collect-garbage
Hi
Great project... loving it
Installed macos and trying to install Xcode and ran out of space (50GB)
How do you setup a bigger diskSize?