How to refer a custom package?

Say I want to run nix-shell and include some package in nixpkgs, I can write

with import <nixpkgs> {}; 
stdenv.mkDerivation {
   buildInputs =[some package];

It becomes less obvious when I have a custom package in my systemPackage as

environment.systemPackage = with pkgs;[
(with pkgs; callPackage ./pkgs/my_pkg {})

Then how to include my_pkg in some default.nix so that I can build some other software based on my_pkg which is actually a lib?


Overlays are used for extending the package set: Overlays - NixOS Wiki

I have a video showing how to substitute packages here:

1 Like