diff --git a/nix/templates/harness-base.nix b/nix/templates/harness-base.nix index fe12bb4c..437d7440 100644 --- a/nix/templates/harness-base.nix +++ b/nix/templates/harness-base.nix @@ -1442,6 +1442,19 @@ in boot.isNspawnContainer = true; + # Use a disk-backed /tmp instead of the default tmpfs so large scratch + # writes (nix-develop shells, cargo build dirs, multi-GB downloads) land + # on disk rather than eating container RAM. The tmpfs default mounts + # ~3.2 GB of RAM per container; disk-backed /tmp is effectively unlimited + # and cheaper for agents that do heavy build work. + # + # cleanOnBoot defaults to false in nixpkgs — set it explicitly so /tmp is + # cleared on each container start (D! tmpfiles rule), preserving the same + # ephemeral-per-boot semantics agents already expect from the old tmpfs, + # just without the RAM cost. + boot.tmp.useTmpfs = false; + boot.tmp.cleanOnBoot = true; + # Every agent gets flakes + the modern `nix` CLI out of the box. # Equivalent to passing `--extra-experimental-features 'nix-command # flakes'` on every invocation. Agents shell out to `nix build` /