Override flakes inputs transitively


I have several flakes, let’s say A, B, C which have dependencies C->B->A.
Their inputs urls point to their github repos normally but when I develop I want to vendor all dependencies locally.

I’ve tried using --override-input but it only overrides inputs on the most immediate flake. For example I don’t know how to override A when building C.
I’d like to be able override inputs regardless how deep in the hierarchy they lie.

Is there a way how to do that other than writing a custom script to do all the overrides inside flake.lock for me?



I think you can do this, and if you nix flake lock --override-input A ../A, it will build C with B with local A. You could add a separate “localB” input, and add separate outputs using it if you don’t want to change it each time you are developing locally.


  inputs.B.url = "...";
  inputs.B.inputs.A.follows = "A";
  inputs.A.url = "...";
1 Like

follows and input overriding in inputs definition both have their places (and inputs.B.inputs.A.follows = "A"; is an example of both) but they are probably not what I’m looking for.

In your example you add

  • inputs.A.url = "..."; which is really is superfluous
  • inputs.B.inputs.A.follows = "A"; which may or may not be necessary/proper/correct from a design standpoint.

and it brings possibly unnecessary knowledge of B dependencies into C. This gets convoluted very fast in my opinion and in my limited experience.

I think I just really want something like --override-input-recursively :frowning:

Here is my real world example: I have cadquery/flake.nix at 5a389bb738b5da86f7646a7292bedb1786730430 · Grawp/cadquery · GitHub and let’s suppose I change something in pywrap which is ocp's dependency and I want to try it but I do not want cadquery to know that its ocp dependency has pywrap dependency!
I do not want to flatten the dependency tree into some list. I just want to override all pywrap nodes in the tree for one time experiment.

1 Like

I think this does it. nix flake lock --override-input ocp/pywrap ../pywrap

Noice. This will come handy. Shame one can’t use something like --override-input "**/pywrap" ....

I grepped for the error I got, and checked in the Nix source, and saw that it parses it with a / to figure this out. Now I just checked the man page / nix flake lock --help, and see that it has an example with the path “dwarffs/nixpkgs”, and realized I had read that before but not realized what it meant.

I finally decided to write a small script to do what I want directly in a lock file.
Here it is Uli/nix-things: Personal collection of useful Nix related things - replace-locks at main - nix-things - Codeberg.org

1 Like

Agree. This is still a problem if a change to an input is not a simple update within the same git branch.