Flake inputs have to be statically and literally be known at file read time. There is no way to build them dynamically or change them.“after the fact”.
Yes, thats clear. No intention to use something like impure mode.
The idea is to have one simple (fixed) attribute to quickly switch the complete section at build time.
Maybe flake-file can be of help, give it a go, the following will create your flake.nix (since flake.nix is static Nix subset):
mv flake.nix flake-file.nix # <- your current flake but now you can use interpolations at inputs, etc.
nix-shell https://github.com/vic/flake-file/archive/main.zip -A flake-file.sh --run bootstrap
Have you considered using DNS to change the hosts? If the contents are the same, the lockfile won’t differ. You could even use a local proxy webserver to terminate TLS.
If you’re not ok with that, flakes and input pinning aren’t what you want.
I think a mirroring feature would be very nice, but alas, nix doesn’t have one - as I’ve argued before, probably because there’s commercial interest in it and at least one vendor has managed to capture that with a proprietary service.
flake-compatish supports overriding inputs using Nix expressions so you can achieve essentially whatever you want while still being flake compatible for external users (they won’t get your overrides unless they also use flake-compatish ofc)
Seems there are a lot ways around - but no real clean nix core support.
Having a single dependency to exactly one [microsoft|azure|github] repo beeing live and reachable exactly at your build/reconfig time may become a issue!? A git clone is easy and cheap to host everywhere. Git Tree SHA1/SHA256 and Commit/Tag ed25519 signatures will ensure content correctness.
I will go now the local (fake-) dns and reverse-proxy route and let the caddy reverse proxy upstream backend health logic figure out the current enviroment.
Not perfect for resource constrained desktops or mobile devices - but will do the job.
Having git > 2.49 already in nix core, the modification for flakes to mange resource saving local git partial bare clones of the upstream repos instead of a full new complete checkout in store everytime only a single bit changes should be possible?
Does Nix read your Git config files? If it does, you can add insteadOf rules to your Git config and change them depending on the connection. That might be simpler that running a proxy.