deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

`$TMPDIR` env var not entirely respected in local builds

Open jficz opened this issue 1 year ago • 3 comments

I effectively cannot build any configuration when the build machine has /tmp mounted on a partition (or tmpfs in my case) when there isn't enough space for the build (which is a rather common occurrence lately). Same as with remote builds when the target machine is limited similarly.

The workaround for nixos-rebuild is to set $TMPDIR to somewhere with enough capacity for the build but this is not entirely respected by deploy as a part of the build does happen in whatever TMPDIR is set to but the "big" build still happens in /tmp either locally or on the remote machine, depending on remoteBuild.

Example error for a local build, TMPDIR set to /tmp2:

🚀 ℹ️ [deploy] [INFO] Building profile `system` for node `muffy`
error:
       … writing file '/tmp/nix-build-etc-alsa-conf.d-49-pipewire-modules.conf.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90'

       error: writing to file: No space left on device
🚀 ❌ [deploy] [ERROR] Failed to push profile: Nix build command resulted in a bad exit code: Some(1)

For local builds, TMPDIR should imho be respected in all build phases. For remote builds see #282.

The only workaround that works for me (tm) is to remount /tmp to some place with enough capacity for the duration of the build, which is ... not optimal.

jficz avatar Jul 11 '24 15:07 jficz

Would you rather have deploy-rs read the env var or an option via the cli?

weriomat avatar Jun 14 '25 16:06 weriomat

hmm.. good question. I think respecting $TMPDIR would be consistent with upstream (and with the general purpose of that variable) and therefore imho a more "expected" approach by whoever sets that env var

jficz avatar Jun 14 '25 16:06 jficz

Feel free to test the PR :)

weriomat avatar Jun 14 '25 16:06 weriomat