Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: nix commands do not follow flake-url symlinks #9463

Open
con-f-use opened this issue Nov 27, 2023 · 2 comments · May be fixed by #9499
Open

bug: nix commands do not follow flake-url symlinks #9463

con-f-use opened this issue Nov 27, 2023 · 2 comments · May be fixed by #9499
Labels
bug flakes idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. new-cli Relating to the "nix" command

Comments

@con-f-use
Copy link

con-f-use commented Nov 27, 2023

Describe the bug

If the flake path is a symlink, Nix refuses to interact with a given flake "because it's not a directory".

Steps To Reproduce

$ pwd
/tmp

$ mkdir flake

$ ln -s flake flakelink

$ cd flake

$ nix flake init
wrote: /tmp/flake/flake.nix

$ nix build '/tmp/flakelink/#hello'
error: path '/tmp/flakelink' is not a flake (because it's not a directory)

Same for other flake commands.

Expected behavior

The symlink url should exhibit approximately the same behavior as cd ../flakelink && nix build './#hello' would.
I'd expect the symlink is followed and the flake is build, with the result link in the current directory.

$ nix-env --version
nix-env (Nix) 2.18.1
@con-f-use con-f-use added the bug label Nov 27, 2023
@con-f-use
Copy link
Author

Even if that is intended behavior, there it might be possible to have a trailing / in the flake path to indicate to follow symlinks, or a warning when doing so or a --follow-link-to-flake flag for mitigation of this.

@con-f-use con-f-use changed the title bug: nix command do not follow symlinks to a flake bug: nix commands do not follow flake-url symlinks Nov 27, 2023
@roberth roberth added flakes new-cli Relating to the "nix" command labels Nov 27, 2023
con-f-use pushed a commit to con-f-use/nix that referenced this issue Nov 30, 2023
@con-f-use con-f-use linked a pull request Nov 30, 2023 that will close this issue
@thufschmitt thufschmitt added the idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. label Dec 1, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-12-01-nix-team-meeting-minutes-108/36402/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug flakes idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants