So, adding package on top of nixpkg is simple. But how to do 2 packages, with one depending on the other? They are just derivations. The easiest way is probably to have them refer each other by path, and have a top file that contains and builds the leaf derivations. It is the build of the deriviations that gets cached.