-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Describe the bug
nix <cmd> --update-input ... fails when the following conditions come together:
- when called in a git worktree, i.e. when
.gitis a file (pointing to the real repository) instead of a directory. - when the worktree is clean
It reports the worktree as a shallow clone and that it needs a deep clone to update the inputs.
error: '/path/to/repo' is a shallow Git repository, but a non-shallow repository is needed
… while fetching the input 'git+file:///path/to/repo'
Steps To Reproduce
- Enter a git repo with a flake that has inputs.
- Create a worktree with
git worktree add ../workree branch cd ../worktreenix flake lock --update-input <input>or any other command that accepts the--update-inputoption
Expected behavior
Updates the input.
nix-env --version output
2.4
Workaround
- Run
nix <cmd> --update-input <input> path:., which forces nix to interpret the flake URL as a path and avoids thegit+file://codepath. - Modify any tracked file (not necessarily
flake.lock) to make the tree dirty, also solves the issue.
hraban and NyCodeGHG