[Nix#9253] Symlinks to flakes have poor UX #106
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Upstream-Issue: https://github.com/NixOS/nix/issues/9253
Describe the bug
Flakes do not place nicely with symlinks. This leads to a plethora of UX issues.
Symlink
flake.nixto relative pathFirst, you might try to symlink the
flake.nix, which leads to this confusing error message:In this case, Nix copies the
flake-symlinkdirectory to the Nix store (probably) and then tries to evaluateflake.nix, which is a symlink to the parent directory, so it looks for/nix/store/my-actual-flake-dir, which does not exist.Symlink
flake.nixto absolute pathIf we use a symlink to an absolute path, we get another confusing error message:
Symlink to a flake directory
Then we might try to symlink the directory itself. This leads to another two confusing errors:
But if we actually
cdinto the "not a directory", we cannix buildfine (if we've filled in ourflake.nix):This is inconsistent with the "not a flake" diagnosis that
nix buildwith a path to the symlink gives.Steps To Reproduce
See above. Note that no actual content in the
flake.nixis required.Expected behavior
I expect the build to "just work", as if the symlink was a regular file. I would expect Nix to copy the destination file in place of the symlink when it copies the file to the Nix store, at least if the symlink's destination is neither in the Nix store or in the repo/directory being copied into the Nix store.
If we instruct Nix to
nix builda symlink, we should probablynix buildthe symlink destination instead, transparently — in the same way that if I have a Git repository at~/.dotfileswith a flake in~/.dotfiles/config/home-manager, Nix will seamlessly translate the current directory togit+file://{path-to-repo-root}?dir={path-to-current-dir-from-root}:nix-env --versionoutputnix-env (Nix) 2.17.0This issue was mentioned on Gerrit on the following CLs: