Adding a custom input alias

I have a selhosted Forgejo instance, and want to draw my flake inputs from it.

Right now I have to use ssh+git://forgejo@my-url:customport/owner/repo, which is very tedious.

I’d like to create a new alias (such as github:owner/repo) that points to this url specifically.

Tried some things with the nix registry, but as I don’t really understand its purpose and how it’s applied, I think I’m headed the wrong way.

Any pointers on how to achieve this ? I guess I’m not the first one trying

1 Like

You may be able to use ssh match blocks to configure the user and port, though doing so will also mean the flake cannot be evaluated outside your specially configured environment. I don’t think you can condense it more than that, you’ll still need to use ssh+git.

My advice is to just accept the tedium.

You can’t use the registry for this, as nix no longer supports using the registry in flake inputs. Of course you can still override an input to use the registry on the command line, but that feels even clunkier to me.