There’s nix-init which seems to be doing some (or most) of the work involved when making a new package. It’s maintained by @figsoda.
This is the relevant documentation. There’s also nurl for a bit more automation around Nixpkgs fetcher calls:
Unfortunately, Nixpkgs docs concerning how to actually make packages generally suck. If you really want to understand it or need a custom solution, at the moment you have to read the code, a lot of code, and figure out what could work for you.
The documentation team is of course, in a sense, responsible to improve the situation, but the sheer scale of it makes things take forever. @danielsidhion is currently doing the heroic work of a complete review pass of the Nixpkgs manual. Just to give you a sense of the API surface area, here’s a survey of the Python infrastructure @alejandrosame diligently compiled last year.
For a general introduction to packaging in Nixpkgs, @proofconstruction wrote a tutorial for nix.dev:
You’d then expose your Nixpkgs-style packages in flake.nix with callPackage, as nicely outlined by @jade:
If you need more depth, @NobbZ wrote an overview of how to use callPackage, and if that’s still confusing, @roberth and @infinisil made a really good introduction to fixed-point computation on attribute sets.
Everything is kind of there, but both in terms of tooling and documentation we’re still lacking well-rounded packaging. For overview-style documentation, the place for that is nix.dev – contributions highly appreciated!