nix eval
tries to create ~/.cache
even with eval-cache
disabled
#12575
Labels
nix eval
tries to create ~/.cache
even with eval-cache
disabled
#12575
Describe the bug
During evaluation Nix tries to cache some things, creating
$XDG_CACHE_HOME/nix
to store them. With earlier releases of Nix, we could do evaluation with a homeless user by providing--option eval-cache false
which was enough to stop Nix from doing that. Using latest versions of Nix, that is not enough, and whenever I try to eval an attribute from a flake, I get error:Steps To Reproduce
I managed to only reproduce this on macOS.
Create a user home set to
/var/empty
:Clone some flake, for example Nix itself:
Try evaluating a value from the flake using that user:
Note that I copy the flake to Nix store to share it with the user, but it could be any shared path.
Get the error mentioned before:
I tried reproducing this issue using Linux VM via NixOS tests, but it appears to be specific to macOS.
Reproducing in NixOS test
I wrote
test.nix
like this:And tried running it against the same versions that fail on macOS like this:
And it succeeded. Note that if I remove
eval-cache = false;
in the config, it fails on cache creationg as expected.Expected behavior
The flake should evaluate without
~/.cache
available.Metadata
Additional context
I've tried bisecting Nix repo between 2.20 and 2.21 branch points, as 2.21 seems to be the first release with this issue. I used this script to test commits:
Note that if Nix fails to build, I tell
git bisect
to skip the commit using exit code 125.Here's the resulting log of the bisection:
git bisect log
At a glance I can't see which of these could trigger such issue.
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: