Hello, trying out flakes and I was wondering if there’s a way to run something like nix flake update but use the nixpkgs revision that is currently being used by the system. The system is now also using a flake build (nixos-rebuild switch --flake 'path:...').
To try to avoid an XY problem, what I’d like to do is update a flake that has multiple inputs, including nixpkgs.url = "github:NixOS/nixpkgs";. I want all of them to update to the latest version except nixpkgs which I’d like to use the version that NixOS is using. My reason is that I likely already have the packages in my store for that version and I can avoid having to download quite as many copies.
I do have nix.registry.nixpkgs.flake = inputs.nixpkgs; in my host config, so I think I might be able to use flake:nixpkgs instead of the github link. This doesn’t quite seem like the right solution though.
I’ve seen --override-input used, but the manual says that will not update the lock file. I want to update the lock file, just with the rev of my system.
Can anyone recommend a good solution (or tell me why what I’m asking doesn’t make sense)?
To try to avoid an XY problem, what I’d like to do is update a flake that has multiple inputs, including nixpkgs.url = "github:NixOS/nixpkgs"; . I want all of them to update to the latest version except nixpkgs which I’d like to use the version that NixOS is using. My reason is that I likely already have the packages in my store for that version and I can avoid having to download quite as many copies.
Assuming that you absolutely do not want to use the registry when defining your inputs:
Or, specifically in the case of nixpkgs, just use the default which happens to be to get it from the registry. An example of this can be seen in the trivial template. To test if this works for you, simply do:
I use flake:nixpkgs with a registry linking to my system input
Doing this in general is probably frowned upon a little, since the entire point of flakes is pinning consistently, and avoiding host state to leak in. I think this is fine in some contexts though, because flake.lock still guarantees revisions, and sometimes there simply are good use cases for using what’s already on the system, rather than downloading dozens of independent copies of nixpkgs (especially if you use devShells a lot).
The --override-input line seems to work, but then I don’t get why the manual page says This implies --no-write-lock-file, because it did write to the lock file, both to update it and to create it if I try deleting it.
On the registry version, if I do that I see this in the lock file: