TB: Build a nix pkgs out of nixpkgs

Sean Borg June 08, 2026 [Tiny Blog] #Nix

Nixpkgs uses CallPackage to simplify things in Nixpkgs

Often I find myself making things to eventually go into my nix config so taking advantage of CallPackage is helpful, but it can be quite tedious to build my whole config repeatedly to confirm I got all the nix right...

Here is where this short snippet comes in handy

nix-build -E 'with import <nixpkgs> { }; callPackage ./path/to/default.nix { }'

This builds like nixpkgs does allowing me to test everything without needing to jump to my config and build the whole machine every time.

Think I originally learned (and have now forgot) how callpackage works from https://github.com/NixOS/nixos-summer/blob/main/content/blog/callpackage-a-tool-for-the-lazy.md this has now been used as a base to write https://nix.dev/tutorials/callpackage which I shall have to read at some point.

Attempting to find the original article I read I came across a few links, I have barely skim read but hopefully will have some time to one day