Sharing flake.lock (or parts of it) between flakes

Say I have one flake F1 that has two inputs abc and xyz. Say they are currently at revisions abc.A and xyz.A. That’s recorded in F1's flake.lock.

I then create another flake F2 which has the same inputs abc and xyz. However, in the meantime, the dependencies changed to newer revisions abc.B and xyz.B. That’s recorded in F2's flake.lock.

Without resoting to “workarounds” like using symlinks - because in general I might not have control over F1, but may over F2 - is there a way to keep these in sync somehow (either unidirectionaly or bi-directonally and either on the lock-file level or input-level)?

That is, make F1.abc and F1.xyz always be the exact same revisions as F2.abc and F2.xyz?

This is what follows is for:

# F2 flake.nix
{
  inputs = {
    abc.url = "...";
    f1.url = "...";
    f1.inputs.abc.follows = "abc";
  };
}

This makes F1’s input abc use the version that F2 has abc locked to.

1 Like