Flakes within flakes - can a input access outputs from the caller?

I have a bit of a problem. It used to work until recently, but basically, I have four private Flake repos, which use parts of my public nixfigs Flake, and then the public Flake calls these private flakes like so:

nixosConfigurations = import ./hosts/nixos // inputs.nixfigs-private.nixosConfigurations;

This used to work, but now I’m running into a recursion error.

I could use git-crypt, but I would rather use external repos. It’s a tricky one. I want to keep the private Flake repos private, especially the work computer ones.

One way I thought, could be if a Flake input can access outputs from the invoker.

Is that possible?

EDIT: nixfigs.git

I can create a censored version of nixfigs-work.

Share the error, please…

Interesting. Trying again is not producing the ‘Infinite recursion’ error.

However, my Flake lockfile on nixfigs-work and nixfigs has reached 50MB. GitHub is now warning me about that.

OK, so the issue I think I’m running into now is the sheer size of flake.lock. There’s a lot of inputs duplicated. I think the way forward is to use inputs."$input".follows.

EDIT: nix flake update is just hanging now. If I remove the nixfigs input from nixfigs-work, it works fine.

To add some more info: I have nix.package set to pkgs.nixFlakes. I don’t know if that needs to be changed.

I’ve also set the inputs.follows options for nixfigs-work in my nixfigs repository.

Currently, I’m seeing a total hang when building any nixosConfiguration, or indeed when running any Flake command.

Got an error at last. It took a while to wait for the nix flake update command to run.

error:
       … while updating the lock file of flake 'git+file:///home/dzrodriguez/projects/git.shymega.org.uk/shymega/NixOS/shymega/nixfigs-priv'

       … while updating the flake input 'nixfigs'

       … while updating the flake input 'nixfigs/nixfigs-work'

       … while updating the flake input 'nixfigs/nixfigs-work/nixfigs'

       error: found circular import of flake 'github:shymega/nixfigs'