We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
nix <cmd> --update-input ... fails when the following conditions come together:
nix <cmd> --update-input ...
.git
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
git worktree add ../workree branch
cd ../worktree
nix flake lock --update-input <input>
--update-input
Expected behavior
Updates the input.
nix-env --version output
nix-env --version
2.4
Workaround
nix <cmd> --update-input <input> path:.
git+file://
flake.lock
The text was updated successfully, but these errors were encountered:
Update
It is even worse, I am unable to do anything inside a clean ckeckout as described above. Even a simple nix build .#<package> errors.
nix build .#<package>
Sorry, something went wrong.
This is still valid and doesn't work as of 2.13.6:
2.13.6
[I] rollf@nixos /tmp/ ❯ nix-env --version nix-env (Nix) 2.13.6 # Shallow copy: [I] rollf@nixos /tmp ❯ git clone --depth 1 https://github.com/NixOS/nixpkgs.git ... [I] rollf@nixos /tmp ❯ cd nixpkgs/ # "shallow=1" is provided by default: [I] rollf@nixos /tmp/nixpkgs (master) ❯ nix build -L --show-trace --keep-failed .#hellow error: flake 'git+file:///tmp/nixpkgs?shallow=1' does not provide attribute 'packages.x86_64-linux.hellow', 'legacyPackages.x86_64-linux.hellow' or 'hellow' Did you mean one of hello, below, halloy or jello? # Works fine in the repo itself: [N] rollf@nixos /tmp/nixpkgs (master) [1] ❯ nix build -L --show-trace --keep-failed .#hello [I] rollf@nixos /tmp/nixpkgs (master) ❯ ./result/bin/hello Hello, world! # Doesn't work in a worktree: [I] rollf@nixos /tmp/nixpkgs (master) ❯ git worktree add ../feature-x ... [I] rollf@nixos /tmp/nixpkgs (master) ❯ cd ../feature-x/ [N] rollf@nixos /tmp/feature-x (feature-x) ❯ nix build -L --show-trace --keep-failed .#hello error: … while fetching the input 'git+file:///tmp/feature-x' error: '/tmp/feature-x' is a shallow Git repository, but shallow repositories are only allowed when `shallow = true;` is specified. # Works fine with the workaround mentioned in ths PR: [I] rollf@nixos /tmp/feature-x (feature-x) [1] ❯ nix build -L --show-trace --keep-failed path:.#hello [I] rollf@nixos /tmp/nixpkgs (master) ❯ ./result/bin/hello Hello, world!
Relevant issue is #3756 which seems to have fixed in with shallow copies per se, but not in worktrees
No branches or pull requests
Describe the bug
nix <cmd> --update-input ...
fails when the following conditions come together:.git
is a file (pointing to the real repository) instead of a directory.It reports the worktree as a shallow clone and that it needs a deep clone to update the inputs.
Steps To Reproduce
git worktree add ../workree branch
cd ../worktree
nix flake lock --update-input <input>
or any other command that accepts the--update-input
optionExpected behavior
Updates the input.
nix-env --version
outputWorkaround
nix <cmd> --update-input <input> path:.
, which forces nix to interpret the flake URL as a path and avoids thegit+file://
codepath.flake.lock
) to make the tree dirty, also solves the issue.The text was updated successfully, but these errors were encountered: