What are overlays?

overlays are a way to apply many changes to a package set. You can add or modify packages, and these overlays can be composed with other overlays.

final: # package set with all overlays applied, a "fixed" point
prev: # state of the package set before applying this overlay
{
  my-new-package = prev.hello;
  some-other-package = final.my-new-package;
}

Then “applying” the overlay usually looks something like:

let
  my_overlay = import ./my-overlay.nix
  pkgs = import  <nixpkgs> { overlays [ my_overlay ]; };
in pkgs.some-other-package
2 Likes