Skip to content

Nixpkgs's Advanced Usage

callPackage, Overriding, and Overlays are the techniques occasionally used when using Nix to customize the build method of Nix packages.

We know that many programs have a large number of build parameters that need to be configured, and different users may want to use different build parameters. This is where Overriding and Overlays come in handy. Let me give you a few examples I have encountered:

  1. fcitx5-rime.nix: By default, fcitx5-rime use rime-data as the value of rimeDataPkgs, but this parameter can be customized by override.
  2. vscode/with-extensions.nix: This package for VS Code can also be customized by overriding the value of vscodeExtensions, thus we can install some custom plugins into VS Code.
  3. firefox/common.nix: Firefox has many customizable parameters too.
  4. ...

In short, callPackage, Overriding and Overlays can be used to customize the build parameters of Nix packages.