Open DavHau opened 4 months ago
We could store a diff in or around the lock file. Such functionality would also benefit https://github.com/NixOS/nix/issues/11160, because unmerged PR commits also have a habit of disappearing.
This is a huge regression for me. No longer I can't use --override-input
I get the same error when also referencing a local directory in flake.nix
.
Why was this change necessary? Is there a workaround for it?
First we had change that prevented using a relative path and now this. It makes it so much more problematic testing things before making a commit.
Edit: looks like even having a local commit is not enough I need to push my change to repo and reference it to be able to use it. There's no way this isn't a bug is it? How can I use a local repo now?
Also having the problem here of none of several methods I tried which worked in older versions of nix yielding the ability to override the nixpkgs input of a flake to point to an on-disk work in progress of nixpkgs.
nix flake lock --override-input <input> <override> <input>
, which I would expect to have the effect of addressing the given warning, but that doesn't happen.~Workaround for now (newest working version of nix is nix_2_20):~
nix run nixpkgs#nixVersions.nix_2_20 -- flake lock --override-input nixpkgs git+file:///home/pwaller/.local/src/nixpkgs
(edit, no, sorry - this also doesn't work, yielding: error: lock file contains unlocked input
, during the build).
I think what the warning message might be trying to say is that the flake input be a dirty input, but it doesn't say that. At least to me, 'locking' is a nix concept, and 'dirty' is a git concept, so when the message says 'unlocked input' it is not clear that the underlying reason is a dirty git repository.
I get it to work, but I had:
git status
If this is not a bug and it was intended to work like that it is really bad idea. Frankly I wish the reverse was possible. I sometimes use nix to set up dev environment and was in places where they did not like when I committed nix files with the project, so it makes really hard to use Nix if the whole team doesn't buy it.
I can't figure out how to fix the problem. I change the input url from a local repo to a remote repo, commit the change, and then run nix flake update
and I still get the error. What exactly am I supposed to do in this situation?
Furthermore, if I entirely remove the entry from the lock file and run nix flake lock
, I get error: lock file references missing node '<input-flake>'
. This must be a bug, surely?
Also got this error... do I understand that it's now impossible to refer to a local folder with uncommited changes?
I am developing a flake that contains microVM configurations. The local machine can then refer to it with its specific environment, allowing for production, staging, development, etc.... While in development, I got to somehow test those changes, but the flake itself is unuseable without a host. So, I tend to refer to it from a development host to make sure it makes sense before committing new code.
Now, it seems that whenever I create a new microVM configuration, I got to commit untested stuff before I can even try it at all.
Is there a workaround for that specific case?
I am also in dire need for a solution for this. I don't want to create a commit every time I'm trying out a change in a flake I'm referring to ..
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
Not sure if this intentional, but with recent nix versions (using 2.23.x), I cannot persist an input override anymore that points to a local unclean repo.
Since nix now defaults to use
--no-write-lock-file
in this case, it is not possible to persist the override. I found this capability useful, as it allows me to continue operating on the overridden flake, without having to pass--override-input
every single time. This is specifically needed, when I operate on the flake via some other tools, which do not support passing extra options to nix.Though I can see that doing this might be bad practice, as there is a risk of people publishing non-reproducible flakes if that is allowed. So, not sure if a feature or a bug.
Add :+1: to issues you find important.