I pinned my nixpkgs in with nix registry. I would like to lock nixpks input of the flake for my git project to the same version I have already pinned. There is not such command like nix flake lock nixpkgs github:NixOS/nixpkgs/<sha here>. How can I pin/lock an input of my flake?
If your flake omits the inputs.nixpkgs declaration (but specifies it in the arguments to outputs) then it will take it from your registry, so if your registry has a pinned definition then it’ll use that. The downside is this means it’s now dependent upon per-user/per-machine state, but I expect that to only matter when updating the input.
That might be the workaround I am looking for.
The thing I am trying to avoid is that nix flake lock needs internet access to get the newest nixpkgs. For the sake of development I would like to lock it to the thing I have already in nix store.
When I apply the workaround the flake.nix is not complete. So I should revert the workaround before I push the commit. It gets needlessly complicated :(.
In your flake.nix, try something like
inputs = {
nixpkgs.url = git://nixos/nixpkgs?ref=unstable&rev=e486d8d4
};
outputs = { self, nixpkgs } : {
...
};
There are many alternatives described in nix flake - Nix Reference Manual.