Open NiklasGollenstede opened 4 months ago
@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 locked
field and only "mark it" for deletion in a future revision of the lock format?
I'm running into the same issue using nix 2.23.0
after updating from nix 2.20.x
.
I had used --override-input with nix 2.20 and nix 2.23 crashes:
error: … while updating the lock file of flake 'git+file:///home/grmpf/synced/projects/hyperconfig error: lock file contains unlocked input {"dirtyRev":"bfb7a882678e518398ce9a31a881538679f6f092-dirty","dirtyShortRev":"bfb7a88-dirty","lastModified":1716509168,"narHash":"sha256-T6xYKgn1HRVpucBMPn5iAL4ZYu9WErmvjc1ZPxaSgLY=","type":"git","url":"file:///home/grmpf/synced/projects/github/nixpkgs"}
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
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 simplenix 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 071dd2b3a4e6c0b2106f1b6f14ec26e153d97446). 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 071dd2b3a4e6c0b2106f1b6f14ec26e153d97446?)Priorities
Add :+1: to issues you find important.