Nothing but literal data is allowed in flake.nix outside of outputs, unfortunately. Personally, I’m actually getting around this by having my flake.nix generated in a pre-commit hook, essentially caching information computed elsewhere. That was quite a bit of work to set up robustly, though.
Yeah, that’s a good point. There are use cases where there are alternatives, e.g. if you’re doing this because you want some form of inheritance you can define inputs like:
I use this pattern quite a bit, since I think flakes’ most useful purpose is to share development tooling setups between multiple repositories, and for that sharing specific input versions is very desirable.
You can even combine that with subflakes if you’re doing this just to make your inputs block look less busy.
You can never totally DRY out inputs, though. This is by design, since nix wants to avoid expensive evaluation for deeply nested trees of flakes when you use e.g. nix flake show. It is also one of the big criticisms of flakes - I personally still believe they should never have been turing-complete nix files to begin with.