Nix using store in /var, bind mount?

I have a server where I have enough space available on /var, but not on the root filesystem, and I want to install Nix on that machine. Can I just install it, then move /nix to /var/nix-store and then bind-mount /var/nix-store to /nix?

yes you can, the same way iso uses ro-store and rw-store in overlayfs

2 Likes

I tried this, and now I’m getting:

error: cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Connection refused.

Did I do anything wrong? I did mv /nix /var/nix and then bind-mounted /var/nix to /nix (and restarted nix-daemon).

I was able to solve this by executing

systemctl stop nix-daemon
systemctl stop nix-daemon.socket
systemctl daemon-reload
systemctl start nix-daemon

In case anyone comes across this.

1 Like

please mark it as a solution! :slight_smile:

I’d love to, but I don’t see a way how to…

Oh!, maybe because you don’t have enough reputation yet, or some other ‘privilege level’ stuff?

Hosted by Flying Circus.