wiki/notebook/tools.nix.overrides-and-overlays.org
Gabriel Arazas 5242780327 Revise Nix-related notes
Added more notes as I developed the Guix overlay for NixOS over time. It
does have a nice experience, overall (albeit clunky one due to the documentation).
2022-10-25 16:58:19 +08:00

1.2 KiB

nixpkgs overrides and overlays

You can override values in nixpkgs as a way to customize nixpkgs. For example, if you want to use a different version from the nixpkgs channel, you can change the appropriate value.

let overlay = self: super:
      {
        ncmpcpp = super.ncmpcpp.override { visualizerSupport = true; };
      }

For another example, you can see some examples from Neovim and Veloren (which also uses Nix flakes).

You can set overlays automatically either by setting nixpkgs.overlays from your system configuration or ~/.config/nixpkgs/overlays/ folder for user-specific settings. You could also set overlays for standalone Nix code similarly through the overlays key — e.g., import <nixpkgs> ? { overlays = (self: super: { } ); };.