In NixOS, the sandbox feature during builds ensures reproducibility by isolating the build process from the host system. The Filesystem Hierarchy Standard (FHS) is generally not followed by NixOS natively, as everything is stored in the /nix/store with symlinks for compatibility, which can cause issues for programs expecting a standard FHS layout. The TMPDIR environment variable is relevant to how applications handle temporary files, and its behavior can differ between the default system environment and specific Nix shells.
Sandboxing and FHS
Sandboxing The Nix package manager strictly sandboxes package builds to guarantee that the resulting package is reproducible and only depends on specified inputs. This isolation means the build environment is a minimal, clean slate, preventing access to most host system files or non-declared dependencies.

TMPDIR environment variable specifies where an application should create temporary files. Its interaction with the Nix sandbox and FHS environments can lead to issues:
Default Behavior On a standard NixOS system, TMPDIR might not be set by default in the global system environment.

/* Create a writable /tmp in the chroot. Many builders need
this. (Of course they should really respect $TMPDIR
instead.) */
#nixos sandbox #tmpfs
https://github.com/NixOS/nix/blob/340f831ebe9d74659b84667b96251b7ab0edd09d/src/libstore/build/local-derivation-goal.cc#L609-L614
besides #lix has something tempting for everyone including nixos
https://github.com/NixOS/nix/issues/13462#issuecomment-3137584843

nix/src/libstore/build/local-derivation-goal.cc at 340f831ebe9d74659b84667b96251b7ab0edd09d · NixOS/nix

Nix, the purely functional package manager. Contribute to NixOS/nix development by creating an account on GitHub.

GitHub

Spotify taking too much disk space? Here's how to fix Spotify cache bloat using tmpfs (RAM) on Debian and Ubuntu Linux.

Step-by-Step Guide: https://ostechnix.com/move-spotify-cache-tmpfs-debian-ubuntu/

#Spotify #tmpfs #RAM #CacheDirectory #Debian #Ubuntu #Linux

Fix Spotify Cache Bloat Using Tmpfs (RAM) On Linux - OSTechNix

Spotify taking too much space on Linux? Here's how to move Spotify cache to tmpfs (RAM), limit its size, and keep your system clean and fast.

OSTechNix

Why #GIMP #AppImage #crashes on #Linux then trying to export / #save files to #tmpfs? A #bug ?

/tmp/.mount_GIMP-3ChpMMA/usr/lib/x86_64-linux-gnu/gimp/3.0/plug-ins/script-fu/script-fu: fatal error: GIMP crashed (script-fu:34154): LibGimp-WARNING **: 13:15:26.695: script-fu: gimp_flush(): error: Broken pipe fish: Job 1, 'GIMP-3.0.4-x86_64.AppImage --ve…' terminated by signal SIGSEGV (Address boundary error)

After some testing, and getting crazy about it, I debugged moar. It seems that the problem is a .json file in the tmpfs dir, it seems to crash GIMP. There’s clearly something very wrong.

Just for fun I created this file: gimp-denial-of-service-attack.json

Feel free to use that to troll colleagues. Place it is some directory they’re likely going to use with GIMP, just for lulz. - Don’t ask me, why it crashes GIMP. #json #gimp #crash

Depuis quelques mois que j'ai un ordinateur avec un peu de RAM en trop, je me suis accordé un petit luxe : monter une partition de 8Go en #tmpfs dans mon home.

J'y mets les documents temporaires de travail pour la session (téléchargements à renvoyer par mail, PDF à lire, etc.), afin de ne pas me retrouver petit à petit avec une pile de documents de plus en plus grande, vu que le contenu du dossier disparaît à chaque redémarrage de l'ordinateur.

A Deep Dive Into Debian 13’s /tmp: What’s New, And What To Do If You Don’t Like It

Debian 13

LowEndBox

For those who need this:

#tmp on #tmpfs #ultras

Help? I created a #ramdisk on #openSUSE #Thumbleweed using #tmpfs and it somehow is persistent. 😳 Isn't it supposed to be "volatile", and wiped on a reboot?

My #computer remebers things it wasn't supposed to. I'm worried what else it remembers. It think it might secretely be sentient. Send help.

#Linux #spooky #GhostInTheShell #how?

LXC теряли память и падали. И при чем же здесь tmpfs и journald?

Старый добрый Proxmox с его контейнерами и виртуалками - по-прежнему рабочая лошадка многих компаний. И если нарезать много-много мелких контейнеров, то может случиться, что память куда-то девается со временем, а контейнеры падают в OOM без очевидной причины. Причем не все. Причем иногда. И зачастую проще перезапустить и ехать дальше чем разбираться. А причина есть, и она оказалось довольно проста.

https://habr.com/ru/articles/883562/

#proxmox #lxc #tmpfs #journald #oom #oom_killer #systemd

LXC теряли память и падали. И при чем же здесь tmpfs и journald?

Старый добрый Proxmox с его контейнерами и виртуалками - по-прежнему рабочая лошадка многих компаний. И если нарезать много-много мелких контейнеров, то может случиться, что память куда-то девается со...

Хабр

There are two kinds of ram disk that you can set up in most Linux systems: tmpfs and ramfs. ramfs is very simple: it's dynamically allocated as you store files and remove them, and it will not go to swap. If you run out of memory in ramfs, you have run out of memory in your system, and bad things will happen.

tmpfs will go to swap if necessary, so it won't kill your system until it has allocated all the memory it can -- and, at mount time, you must specify a limit to the size that it can grow. You can be silly and specify a size larger than RAM + swap, but that's on you.

So the primary downside of tmpfs is having to decide up front how much memory it can use (at max -- it is also dynamically allocated/deallocated). But!

mount -o remount,limit=2G /mnt/mountpoint will reset that limit without wiping the current contents.

You're welcome.
#linux #tmpfs #neepery

Steam Game Recording In RAM; Linux How To

PeerTube