-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
If I have a flake input with a transitive input constrained via follows, then I remove that follows constraint, the new transitive input version in my flake.lock ignores that dependency's original flake.lock.
Steps To Reproduce
-
Create a
flake.nixwith oxalica/rust-overlay@1d1c8a0 as the only input:{ inputs = { rust-overlay.url = "github:oxalica/rust-overlay/1d1c8a009adeb4c0561bb1feea8ec7b97749946b"; }; outputs = { ... }: { }; }
-
Run
nix flake lock, observing that the transitive input is NixOS/nixpkgs@18dd725, the same commit as in rust-overlay'sflake.lock:$ nix flake lock • Added input 'rust-overlay': 'github:oxalica/rust-overlay/1d1c8a009adeb4c0561bb1feea8ec7b97749946b?narHash=sha256-mylLEdzqx4M9TrwFIPc%2Bo0dqabHvFGbNJZGRgE43Ya0%3D' (2025-10-23) • Added input 'rust-overlay/nixpkgs': 'github:NixOS/nixpkgs/18dd725c29603f582cf1900e0d25f9f1063dbf11?narHash=sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38%3D' (2025-04-13) -
Add a separate input for NixOS/nixpkgs@87848bf:
{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/87848bf0cc4f87717fc813a4575f07330c3e743c"; rust-overlay.url = "github:oxalica/rust-overlay/1d1c8a009adeb4c0561bb1feea8ec7b97749946b"; }; outputs = { ... }: { }; }
-
Run
nix flake lockagain:$ nix flake lock • Added input 'nixpkgs': 'github:NixOS/nixpkgs/87848bf0cc4f87717fc813a4575f07330c3e743c?narHash=sha256-/oUYsC0lUCBory65VK%2BUHqCCsCspbL1Vgfcf1KUYqVw%3D' (2025-10-20) -
Constrain rust-overlay's transitive Nixpkgs input to follow our direct Nixpkgs input:
{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/87848bf0cc4f87717fc813a4575f07330c3e743c"; rust-overlay = { url = "github:oxalica/rust-overlay/1d1c8a009adeb4c0561bb1feea8ec7b97749946b"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { ... }: { }; }
-
Run
nix flake lockagain:$ nix flake lock • Updated input 'rust-overlay/nixpkgs': 'github:NixOS/nixpkgs/18dd725c29603f582cf1900e0d25f9f1063dbf11?narHash=sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38%3D' (2025-04-13) → follows 'nixpkgs' -
Remove that constraint:
{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/87848bf0cc4f87717fc813a4575f07330c3e743c"; rust-overlay.url = "github:oxalica/rust-overlay/1d1c8a009adeb4c0561bb1feea8ec7b97749946b"; }; outputs = { ... }: { }; }
-
Run
nix flake locka final time, observing that rust-overlay's transitive Nixpkgs input is now neither the NixOS/nixpkgs@18dd725 from rust-overlay'sflake.lock, nor NixOS/nixpkgs@87848bf from the earlierinputs.nixpkgs.follows, but is instead whatever is the latestnixpkgs-unstablecommit at the time the command is run:$ nix flake lock • Updated input 'rust-overlay/nixpkgs': follows 'nixpkgs' → 'github:NixOS/nixpkgs/cb82756ecc37fa623f8cf3e88854f9bf7f64af93?narHash=sha256-0JDOal5P7xzzAibvD0yTE3ptyvoVOAL0rcELmDdtSKg%3D' (2025-10-20)
Expected behavior
I expected rust-overlay's Nixpkgs input to revert back to NixOS/nixpkgs@18dd725 as specified in its flake.lock.
Metadata
I tested this with the current stable Nix on x86_64-linux:
$ nix-env --version
nix-env (Nix) 2.28.5
I also tested this with the current latest Nix on aarch64-darwin:
$ nix-env --version
nix-env (Determinate Nix 3.11.3) 2.31.2
Additional context
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.