Files
lix/doc/manual/rl-next/move-nixdaemon-cache-dirs.md
T
Raito Bezarius 5789f4b0a9 manual/rl-next: fine-tune the release notes
Follow up of https://gerrit.lix.systems/c/lix/+/5346?tab=comments for
the obvious pieces.

Change-Id: If0f640f786b0778d016187cb24c0513a48b5a30b
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-03-10 17:09:22 +00:00

1.2 KiB

synopsis, cls, issues, category, credits
synopsis cls issues category credits
Move `/root/.cache/nix` to `/var/cache/nix` by default
4671
fj#634
Breaking Changes
raito

By default, Lix attempts to locate a cache directory for its operations (such as the narinfo cache) by checking the value of $XDG_CACHE_DIR.

However, since the Nix daemon is a system service, using $XDG_CACHE_DIR is not typical in this context.

To address this, systemd provides a better solution. Specifically, when CacheDirectory= is set in the [Service] section of a systemd unit, it automatically sets the $CACHE_DIRECTORY environment variable and systemd will manage that cache directory for us.

Now, our systemd unit includes CacheDirectory=nix, which sets the $CACHE_DIRECTORY and takes precedence over $XDG_CACHE_DIR.

If the daemon is run under user units, systemd will automatically set $XDG_CACHE_DIR.

If neither of these variables is set, Lix falls back to its default behavior. By default, Lix will try to find a cache directory for its various operations (e.g. narinfo cache) by looking into $XDG_CACHE_DIR.

In summary, what was stored in /root/.cache/nix is now moved to /var/cache/nix/nix.