Flake inputs: use git when path unnavailable

Hey. so in my nixos flake i have some inputs on flakes or repos i made, but i have some of these repos locally downloaded on my machine, which makes me want to use the path instead of the git url, so is there a way to verify if the “global” path exists and use it and if it doesnt use the git repo instead?

here is a simple example using wallpapers repo:

{
  inputs = {
    wallpapers.flake = false;
    wallpapers.url = "path:/home/user/Pictures/Wallpapers";
    # wallpapers.url = "github:user/wallpapers";
  };
}

You’d have to use a wrapper script and use --override-input if that path is present.
Also you really don’t want to use path:, use git+file:// or omit the prefix entirely.

Using git+file sounds good thanks.
i dont understand how to make that wrapper could you elaborate a bit more?