nix-build

building a nix package is pretty simple, however the process seems under-documented

table of contents

building a package in the nixpkgs tree

assuming you are at the root of the nixpkgs tree, you can use the -A option to choose a package to build

nix-build . -A xcd

building a maintainer's packages

nixpkgs also includes a fancy convenience script for building all of a maintainer's packages at once

nix-build maintainers/scripts/build.nix --argstr maintainer xfnw

building a nix file with a channel

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

though some special types of packages, such as python ones, have their own version of callPackage

nix-build -E "with import <nixpkgs> {}; python3Packages.callPackage ./default.nix {}"