/tmp is not a tmpfs on NixOS
Dec 2, 2024
The other day I realized that /tmp/
on my NixOS installations is not a tmpfs
as I'm used to from other distros. Instead, NixOS relies on this systemd timer
that cleans up old files from /tmp/
. This is not NixOS specific, other systemd
based distros also run this timer.
Looking at the NixOS boot.tmp related options, we see there's an option
(cleanOnBoot
) that clears files on boot and is disabled by default. I enabled
it for my setup because I'm used to /tmp/
being cleared on boot and I think it
makes sense. Moreover, there's a note about why it's not a tmpfs by default,
it's used during nix builds and it's possible that a build will fail if the
tmpfs runs out of space due to memory constraints.