Equivalent of `--override-input` for `builtins.getFlake`

On the command-line, I can build a flake with my current revision of nixpkgs with --override-input:

nix build --override-input nixpkgs /home/aengelen/nixpkgs

Is it possible to do the same inside a derivation that uses builtins.getFlake? Instead of:

((builtins.getFlake "git+https://codeberg.org/raboof/vola

… I could perhaps put some kind of override or repackaging before invoking .packages?

Is the call to builtins.getFlake your code?

If instead it was listed as inputs.vola.url = ... you could override it in the same way you override nixpkgs.

Yes, I’m using it to include a flake-packaged application in my (‘classic’) configuration.nix, and elsewhere as part of an mkShell that is invoked with nix-shell.

Yeah basically that’s your only option right now.

Basically, you have to fetch the original flake using fetchgit and apply a patch to that inserts inputs.nixpkgs.follows = "/home/aengelen/nixpkgs"; in one derivation, and then use the output path of that derivation as the input to getFlake. This will work because getFlake happily accepts a local path to a flake.

Is that enough info for you to get started?

What solution have you settled on? Fetching the flake and then patching the source?

For now I’m just using a local checkout of the flake where I have flake.lock in sync with the current nixpkgs on that system. Obviously less than ideal :slight_smile: .

1 Like