Nix build directory

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?

what file system is running out of space?

/tmp should be on disk.

might gleam some issues.

It is hard to help ypu here without the actual expression and error…

nixdoes usually adhere to TMP, TMPDIR, and TEMP, though I am not sure in which order of precedence or whatever…

Though I can say for sure I have seen builds happening in both /tmp and /run/users/foo/tmp or what the folder was when I was in a shell already…

So, more and detailed information here might be nice.

PS: by defailt /tmp should be used which by default is on disk. So unless you changed things, there should be plenty of space…

PPS: Last month it took me an hour or two to realize that I am running out of space on /tmp because of my choice to have a 10GiB /

1 Like

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?

I try to build this package on 21.11 nixos:

  chromium_browser_krb = pkgs.chromium.browser.overrideAttrs (attrs: {
    gnFlags = lib.concatStringsSep " " [
  chromium_krb = pkgs.chromium.overrideAttrs (attrs: {
    browser = chromium_browser_krb;

It of course may be incorrect, but I have no ability to check it because of subject.

P.S. Remount tmp with 64Gb, relaying on swap. Will see.

I’ve had good success with

zramSwap = {
enable = true;
algorithm = “zstd”;

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. :wink: