Where should custom fetchers go in nix flakes?

I’ve finally gotten around to writing some tests for one of my nixos flakes. This seems fairly straightforward, however nix flake check seems to expect all contents of packages to be derivations.

I have written my own custom fetcher, modeled after the fetchers in nixpkgs (e.g. gitiles), and it turns out these aren’t derivations:

warning: Git tree '/home/tlater/Documents/Projects/tlaternet-server' is dirty
warning: unknown flake output 'lib'
error: flake attribute 'packages.x86_64-linux.fetchFromCurseForge' is not a derivation
(use '--show-trace' to show detailed location information)

I suppose I could shove that into my lib output and use it from there, but that’s not what upstream nixpkgs does. I’m guessing this is because upstream hasn’t yet had to care about making all packages derivations, so maybe this will change in the future.

My question ultimately boils down to - where should I put a custom fetcher in a flake?

I think lib is the only place where that is possible, for example:

Hrm, fair enough. I suppose that is best practice, and upstream just isn’t following it for historical reasons (yet).