`nix-shell` regression for `shell.nix` symlinks to other directories
@roberth is already working on this.
Since Oct 31, 2024.
- Dominant language
- C++
- Stars
- 17.7k
- Forks
- 2k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 76
Description
Describe the bug
I've got a project set up where I have a top-level shell.nix symlink, which points to ./subdirectory/shell.nix.
When I upgraded to the most recent version of nix (2.24.7) suddenly all expressions in ./subdirectory/shell.nix with relative files (such as import ./foo.nix) try to look for these files not in subdirectory but in the top-level directory instead, which then results in a error: path '/home/user/toplevel/foo.nix' does not exist.
Minimal example
I uploaded a reproducer for the issue here: https://github.com/knedlsepp/nix-11630
Additional context
I bisected the issue and the change of behavior was introduced with commit https://github.com/NixOS/nix/commit/cfe3ee3de84458a8962a6c714e602e6791666101, part of https://github.com/NixOS/nix/pull/11057.
Workaround
Using nix-shell --option nix-shell-always-looks-for-shell-nix false restores the previous behavior. (However the option's name doesn't suggest that this is intended to have an influence)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.