Is there any way to reduce the resources used by nixos-rebuild? Kernel timout errors during rebuild on Raspberry Pi

On my raspberry pi, when attempting to build a minimal config, I get the following output:

.

Once this error is reached, the system is completely unresponsive, event SIGINT won’t make the shell accessible again, though new logs are printed every 121 seconds with the new timeout count.

The message systemdd-journald[1050] Under memory pressure, flushing caches will also be printed at some point.

I really don’t know what this output means, but I suspect the problem is a result of the low-resources environment rather than some more fundamental incompatibility, since the wiki indicates that this model (RPi3+) is supported. I attempted to prevent writing logs to journald, but the journald configs are read-only (they can be changed through nix settings, which requires a rebuild).

If anyone felt like pointing me in the right direction, I would be very grateful.

Evaluating nixpkgs is unfortunately just quite resource intensive. How much memory do you actually have? If you evaluate nixpkgs multiple times (e.g. to add an unstable overlay, or some other inefficient things you could do) then you can save a lot of memory by not doing that. Flakes might help.

That said, that limits your options a bit. I’d suggest looking into remote deployment rather than building on an rpi.

1 Like