Error: path '/home' is a symlink


Nix newbie trying to install Nix on my Synology NAS here. I’ve run into this problem.

I’ve seen multiple times where nix commands do not like that $HOME/.. is a symlink. But I have no control over that. It is a symlink. What can I do?

$ nix-env -iA nixpkgs.glibcLocales
error: path '/var/services/homes' is a symlink

$ echo $HOME

$ ls -l /var/services/homes
lrwxrwxrwx+ 1 root root 14 Sep 25  2023 /var/services/homes -> /volume1/homes

# It does work with a "normal" non-symlink $HOME
$ HOME=$(cd && pwd -P)  nix-env -iA nixpkgs.glibcLocales
replacing old 'glibc-locales-2.38-44'
installing 'glibc-locales-2.38-44'

$ nix --version
nix (Nix) 2.21.0


1 Like

These are all workarounds for making my home directory not be a symlink.

But why does Nix refuse to work with a home dir that is a symlink? Can I not do anything to allow that?

This should be fixed by Handle the case where a parent of ~/.nix-defexpr is a symlink by edolstra · Pull Request #10391 · NixOS/nix · GitHub.