-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Nix as root ignores nix-damon's TMPDIR #7154
Comments
To add a specific use-case to this; this applies to deployments via colmena as it uses
To expand on this with a very clear rationale; if nix uses a separate directory I, as a sysadmin, can decide to mount either a tmpfs there, a different disk, a bindmount, whatever. Especially considering that setting |
This issue can result in failures in Reproducting step
Now you can see the following error:
WorkaroundsWorkaround 1: removing
|
This issue is very annoying - I ran into it now when performing a boot.tmp.useTmpfs = true;
# Use a tmpdir with unlimited space (as opposed to /tmp)
systemd.services."nix-daemon".environment.TMPDIR = "/nix/tmp";
systemd.tmpfiles.rules = [
"d /nix/tmp 770 root nixbld"
]; |
if you run |
My issue was caused by a bad sudo configuration and after fixing it, the alias workaround works for me again. |
This is likely related to #10140: Running |
Note that Nix ≥2.22 (as well as Lix ≥2.91) have the new |
Describe the bug
A clear and concise description of what the bug is.
Nix builds ignore the
nix-daemon
's TMPDIR environment variable when run as root.Steps To Reproduce
TMPDIR=/var/tmp nix-daemon
nix-build '<nixpkgs>' -A hello --check
sudo nix-build '<nixpkgs>' -A hello --check
Expected behavior
A clear and concise description of what you expected to happen.
Both builds should run in
/var/tmp
.nix-env --version
outputnix-env (Nix) 2.11.0
Additional context
Add any other context about the problem here.
This happens all the time when you try to run
nixos-rebuild
because that command obviously needs to run as root.The kernel build notably uses more space than most people have space for in /tmp thanks to BTF.
sudo nixos-rebuild switch
with a custom kernel build is no bueno by default for the vast majority of systems. That's not a good UX.Honestly, I don't see why
/tmp
should be the default. Sure, it can be a useful optimisation if you know your builds are all tiny but that's an assumption you cannot make for all builds in general./var/tmp
is on a physical disk by default and therefore makes a much better default TMPDIR.The text was updated successfully, but these errors were encountered: