docs(nix/nix-1p): Update to use final and prev

The convention has changed to use `final` instead of `self` and `prev`
instead of `super`. This new convention is much easier to understand
especially for users that are new to Nix and Nixpkgs.

This change is notable in the Nixpkgs project code. I added a note
mentioning that the official documentation hasn't been update with
this information. The documentation is currently undergoing an
overhaul and that is why I believe this hasn't been reflected in the
nixpkgs documentation as of yet.

Imported-From: https://github.com/tazjin/nix-1p/pull/9/commits
Change-Id: I901df69a564969b1784b3d7ac629cfaf85093acb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6859
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
vpfeiffer 2022-10-02 15:32:47 +00:00 committed by clbot
parent 3530404a4a
commit 55ea15ab83

View file

@ -569,20 +569,22 @@ but have the modification above be reflected in the imported package set:
```nix
let
overlay = (self: super: {
someProgram = super.someProgram.overrideAttrs(old: {
overlay = (final: prev: {
someProgram = prev.someProgram.overrideAttrs(old: {
configureFlags = old.configureFlags or [] ++ ["--mimic-threaten-tag"];
});
});
in import <nixpkgs> { overlays = [ overlay ]; }
```
The overlay function receives two arguments, `self` and `super`. `self` is
The overlay function receives two arguments, `final` and `prev`. `final` is
the [fixed point][fp] of the overlay's evaluation, i.e. the package set
*including* the new packages and `super` is the "original" package set.
*including* the new packages and `prev` is the "original" package set.
See the Nix manual sections [on overrides][] and [on overlays][] for more
details.
details (note: the convention has moved away from using `self` in favor of
`final`, and `prev` instead of `super`, but the documentation has not been
updated to reflect this).
[currying]: https://en.wikipedia.org/wiki/Currying
[builtins]: https://nixos.org/nix/manual/#ssec-builtins