Flake not accessible through symlink
Describe the bug
Trying to access a flake though a symlink fails with the following error:
error: path '/tmp/nixfiles' is not a flake (because it's not a directory)
Steps To Reproduce
- Create a symlink to a flake.
- Try to build a derivation through the symlink.
$ ln -s ~/Projects/nixfiles/ /tmp/nixfiles
$ nix build /tmp/nixfiles#hello
error: path '/tmp/nixfiles' is not a flake (because it's not a directory)
Expected behavior
It should resolve the symlink and work with the target directory
nix-env --version output
nix (Nix) 2.14.1
Priorities
Add :+1: to issues you find important.
In case someone might find it helpful, I use "$(readlink -f /path/to/flake)" as a workaround.
In my case system.autoUpgrade.flake = "$(readlink -f /etc/nixos)"; works, whereas system.autoUpgrade.flake = "/etc/nixos"; does not.
Hmmm. I was hoping this would work with darwin-rebuild switch --flake $(readlink -f ~/.config/nix)#personal, but that doesn't seem to be the case. Any other workarounds? I've tried:
darwin-rebuild switch --flake ~/.config/nix#personal(default)cd ~/.config/nix && darwin-rebuild switch --flake .#personal(also as a subshell)
Search engines aren't being as helpful as I'd hoped, but I really want to keep my flakes in my dotfiles that I manage using stow. Would definitely appreciate any thoughts.