Nixos-rebuild keeps eating my RAM (asahi)

Hi,

I’m trying to build my usual configuration on my newly installed asahi linux NixOS on a M1 Macbook, however I am not able to achieve the full build due to out of memory errors. Are 16GB of RAM not enough to compile the linux kernel ? I run nixos-rebuild in a TTY with an almost empty system, so I doubt any other process is eating the RAM.
It always crashes during the asahi kernel build.
The build process seems to gradually eat my ram until it’s full and also use a very large amount of disk space (~75GB until now), could some sort of configuration issue cause this sort of problems ? Or is it just that the linux kernel too much of a job for a 16Gb ram macbook ?

Thank’s,
JM445

It might be that your system is building more things than only the kernel. Try the --max-jobs 1 option to nixos-rebuild.
Do you have swap configured? Otherwise it may well be that a Kernel build using all CPU cores exhausts your 16GB of RAM.

It seems to work, although it’s now taking A LOT of time, at least it has not yet failed (2h of building for now). I think the crashes happens because nix was building the kernel AND chromium at the same time.
There is no way to tell nix to not build big packages at the same time, but keep building small things in parallel ?

1 Like

Hi,

did you find something new since then ?
I’m running a Gandi vps with only 1 cpu and 1g of ram.

The builds are consuming too much resources