flake-compat icon indicating copy to clipboard operation
flake-compat copied to clipboard

Support overriding inputs

Open balintbarna opened this issue 2 months ago • 3 comments

Using flakes, we can override inputs of our inputs, such as setting the follows property for nixpkgs inside another input, etc. This should be possible with flake-compat as well. Relevant PR: https://github.com/NixOS/flake-compat/pull/49

balintbarna avatar Oct 28 '25 17:10 balintbarna

Some prior art is https://github.com/NixOS/nix/pull/11952, but if flake-compat finds a more general way, e.g. allowing arbitrary flake by value, I think that'd be preferable.

roberth avatar Dec 07 '25 11:12 roberth

@roberth would you be able to do elaborate on what you mean by "allowing arbitrary flake by value"? Thanks!

adrian-gierakowski avatar Dec 07 '25 11:12 adrian-gierakowski

A "flake" can be refer to potentially many things

  1. a source tree
  2. a source tree and a closure of flake inputs
  3. an entry in inputs
  4. the result of calling flake.nix/outputs and adding those few extra attrs on top of that, notably _type = "flake";, perhaps also inputs
  5. a set of unadulterated attributes pertaining to such a flake call, where the outputs result is morely one of them, and outPath can be accessed without calling outputs (this only exists internally if at all and is not specified)

Input overrides are normally thought of as 1, 2 or 3 at a certain input attribute path, but we have the freedom in flake-compat (and potentially getFlake) to also support 4 or perhaps in the future also 5.

So I was referring to 4, but we may need 5 to make it bug-free.

roberth avatar Dec 07 '25 16:12 roberth