From 55ea15ab83e5cc8390eb330568ffe33bf4eb7281 Mon Sep 17 00:00:00 2001 From: vpfeiffer Date: Sun, 2 Oct 2022 15:32:47 +0000 Subject: 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 Reviewed-by: tazjin Autosubmit: tazjin Tested-by: BuildkiteCI --- nix/nix-1p/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'nix/nix-1p/README.md') diff --git a/nix/nix-1p/README.md b/nix/nix-1p/README.md index bdb49c7def..e7cf1e2d90 100644 --- a/nix/nix-1p/README.md +++ b/nix/nix-1p/README.md @@ -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 { 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 -- cgit 1.4.1