Hi!
I am tried to override the really-heavy package (chromium) to add missing functionality (krb5). And faced with memory limitation for this operation. Then I tried to google and look in manuals and could not find any information about where does nix-build and nixos-rebuild executes genericBuild scripts for packages and how to change it. I tries to use TMDIR variable but no unpacked sources appeared there - just empty folder.
How can I move building directory from limited temporary disk to huge ssd?
That is the root cause. I moved /tmp folder to tmpfs for the security reasons. Is there any way to change build directory without switching /tmp back to disk?
in my configuration.nix… your mileage will vary, it will give you significantly more swap space at the cost of CPU.
You could try a symbolic link , but there must be a way to set it, which escapes me right now.
having tmp files in ram makes a lot of sense , especially with big builds. It can really keep wear and tear down of HDD’s and SSD’s… RAM has a pretty high mean time before failure… spinning rust and SSD’s are doomed to fail by their design.
I solved this problem by moving /tmp onto my larger disk (mv /tmp /data/tmp/) then bind mounting it back to /tmp (mount -o bind /data/tmp /tmp). Seems to have worked while in a Gnome 3 session with no ill effects (yet) but I’m definitely rebooting as soon as nixos-rebuild finishes. For me the bind mount is great because I’m rebuilding nixos and don’t want to revert my config just to move /tmp and rebuild again.
Note that if your security concerns were about data remaining on disk after deletion, using swap may carry similar risks as moving /tmp onto disk temporarily.