[Nix#9253] Symlinks to flakes have poor UX #106
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
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…
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: NixOS/nix#9253
Describe the bug
Flakes do not place nicely with symlinks. This leads to a plethora of UX issues.
Symlink
flake.nix
to relative pathFirst, you might try to symlink the
flake.nix
, which leads to this confusing error message:In this case, Nix copies the
flake-symlink
directory 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.nix
to 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
cd
into the "not a directory", we cannix build
fine (if we've filled in ourflake.nix
):This is inconsistent with the "not a flake" diagnosis that
nix build
with a path to the symlink gives.Steps To Reproduce
See above. Note that no actual content in the
flake.nix
is 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 build
a symlink, we should probablynix build
the symlink destination instead, transparently — in the same way that if I have a Git repository at~/.dotfiles
with 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 --version
outputnix-env (Nix) 2.17.0