What "scope" do "package mechanisms" apply to?

Terrible question, and it also doesn’t help that I have no clue what to collectively name the things I’m interested to get information about… (hence the many quotes). Trying to elaborate:

By “package mechanisms”, I mean overrides, overlays, and flakes.

By “scope”, I mean “members of the Nix ecosystem” (quotes again, for the lack of a better word), but in this case:

  • NixOS/nix repo
    Home of the implementation of the Nix core concepts, Nix CLI tools, the Nix expression language, (more items here)

  • NixOS/nixpkgs repo
    Home of the official package set, some conventions idiosyncratic to Nixpkgs, NixOS, (items)

To the best of my understanding,

overrides (of all colors of the rainbow) came first, then the overlay mechanism improved on the shortcomings of overrides, and then came flakes to solve them all.

I already feel that this short description is inaccurate on at least two levels, but what I was trying to figure out by this question is whether:

  • overrides and overlays only apply in the context of Nixpkgs
    That is, for example, if I would create another package set from scratch, an existing Nix expression would fail with if it uses any convention from Nixpkgs (e.g., overrides, mkDerivation)

  • flakes are a core concept to Nix
    where “Nix” is the high-level notion embodying the functional package management principles from Eelco’s PhD thesis. As for my question, this means that I would have no issues using flakes in my personal package set from above. (And as far as I know, flakes are to provide better composition mechanism when it comes to the inputs, and wouldn’t even touch a package set by default… or something like it.)


Thanks for attempting to wade through this!

1 Like

An “override” is scoped to where you use it, an overlay (which can contain an override) affects the instance of nixpkgs it gets applied to.

Flakes do not extend the scope of either, nor do they solve any of the problems that either is meant to solve.

Instead flakes “just” provide a standardized structure to provide packages (which can be simply overrides of pre existing packages from nixpkgs) and overlays, which again can just add overriden packages or those build from scratch.

Basically 3 solutions for 3 different problems, which can be used together or standalone.

1 Like