-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
"lock file contains unlocked input" when using (dirty) git+file:// input #10815
Comments
@edolstra, It seems that 2.21 lock files are causing trouble for older versions such as 2.18 (NixOS 24.05). Perhaps we could re-insert the |
I'm running into the same issue using nix error: |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-07-03-nix-team-meeting-minutes-158/49097/1 |
I think it's much more than that. For example, I tried: rm flake.lock &&
nix run --no-use-registries github:NixOS/nixpkgs/nixpkgs-unstable#nix -- flake update in order to recreate my lock file from scratch using the latest Which gives back: warning: will not write lock file of flake 'path:/Users/*/.nixpkgs' because it has an unlocked input ('git+file:///Users/*/code/neovim.flake?submodules=1') and does not write/recreate the lock file. So it appears that my choices are:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/refer-to-a-flake-in-a-local-folder/57000/2 |
Nix first started marking (unclean tree) git inputs as unclean, then refused to use inputs marked as such and, as @tmillr points out, also (in an even later version?) refuses to lock them at all. By no means as a permanent solution, but rather as a workaround until, hopefully, Nix's behavior changes, I created a script ( The script, with further comments how and why it works (and drawbacks), can be found here: |
When developing/testing flkes that are primarily inputs to other flakes, I remove the public URL from the including
flake.nix
's input, making the input indirect, and have a~/.config/nix/registry.json
entry redirecting that to the local repo that I'm editing ("to": { "type": "git", "url": "file:///..." }
).A simple
nix flake lock --update-input ...
would then suffice for the depedent flake to use the same version of the input flake that you would get when running commands in the input's tree.Starting with nix v2.21, I get
error: lock file contains unlocked input '{"dirtyRev":"...-dirty","dirtyShortRev":"...-dirty","lastModified":17...,"narHash":"sha256-...","type":"git","url":"file:///..."}'
.That is quite unfortunate, because I liked my previous workflow, and I think that the input is actually perfectly locked. Not to anything that is publicly or necessarily persistently available, but I don't think Nix has any chance to ensure that anyway. As with any other locked input, it will either use the exact version specified (in the
narHash
) or fail if that is not available/obtainable.Not considering dirty repos as proper locks seems to have been an intentional decision by @edolstra (in 071dd2b).
There are probably cases there that interpretation is indeed not helpful, but as stated above, I think my inputs were perfectly locked before.
Steps To Reproduce
{ type = "git"; url = "file:///..."; }
nix flake lock
(with or without oldflake.lock
)error: lock file contains unlocked input '{"dirtyRev":"...-dirty","dirtyShortRev":"...-dirty","lastModified":17...,"narHash":"sha256-...","type":"git","url":"file:///..."}
Expected behavior: The workflow described in the first paragraph still works.
nix-env --version
output: 2.21.2 (anything past 071dd2b?)Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: