Seems like this issue has arisen since I have updated to nixos-24.11.
I am developing a NixOS configuration that depends on a flake I am also developing, which is hosted on Github. In the current context, I have to improve the Github flake and then test the result on the local machine’s /etc/nixos configuration.
Before the NixOS upgrade, I used to casually develop in a clone of the flake, and refer to the flake directly from that folder. Once successful, I used to push the changes to Github and then upgrade the local machine flake input by pointing to the URL instead of the local folder.
It used to work wonderfully, but now, I get this kind of warnings when I point to a local folder:
warning: will not write lock file of flake 'git+file:///etc/nixos' because it has an unlocked input ('git+file:///PATH_TO_THE_CLONE')
Does this mean I have to push every tiny change to the flake to Github just to try it on the local machine?
The closest workaround seems to be to create a temporary commit in your checkout, before using flake lock in the dependent, but I agree that this is not satisfactory.
Guess it’s nice to see I’m not alone with this problem.
Allow me to quote myself on the workaround that I just posted on the liked issue:
I created a script (nix-flake-update) that uses nix v2.20 to update the lock file, and then jq to “clean” it, before verifying that current nix accepts the lock file.
No, because it’s a warning. Building with an overriden dirty input should still work, but Nix won’t write a lock file anymore (which is the correct thing to do: it’s not a lock file if it has an unlocked input in it). You just have to pass --override-input to commands like nix build or nixos-rebuild rather than nix flake lock.