I wonder if that could actually be a nix builtin, some kind of syntax around inputs. “I want to patch my input” is a generic problem, even if nixpkgs’ size makes it more frequent, and nix needs git support to pull the inputs already, so why not have it patch the input before evaluation?
edolstra already has a WIP PR which makes this a builtin, although it’s slightly more limited as you have to have the patch files in the flake rather than fetching.
The trick is the last line of the import, which would expose back a patched nixpkgs which has lib and nixosModules, so you can use the same old nixpkgs.lib.nixosSystem for example. The patched nixpkgs is a bit different than the original inputs.nixpkgs, but that’s as good as I can get it to work.
The results of builtins.fetchTree is not a derivation, and therefore, can be used to avoid IFD in this situation, at least until the new patch builtin is finally merged.