nix
nix copied to clipboard
flakeref: follow symlinks
fixes #9463
Motivation
Given /tmp/flakelink is a symlink to an actual flake directory, currently this happens:
$ nix build '/tmp/flakelink/#hello'
error: path '/tmp/flakelink' is not a flake (because it's not a directory)
This PR attempts to fix that.
Warning: I have no prior knowledge of the nix-codebase or much of a background in C++. Please review carefully. In particular, I do not know if there's any ramification, regarding the use of flakeref in the inputs definitions of flake.nix files or other edge-cases. @infinisil and @YorikSar pressured me into this 😉
Priorities
Add :+1: to pull requests you find important.
I was about to open a PR with the same change.
This PR, if merged, would fix #8013.
I think this is a good and simple change. One thing I would suggest is adding a functional test for this. Have a look at this section of the manual for info on how to set this up.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2024-03-11-nix-team-meeting-132/42960/1
Added you as a coauthor in https://github.com/NixOS/nix/pull/12286