From 317f7f1a4c599086cac578ba6e29369497fbcec6 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Fri, 8 Nov 2024 22:38:34 +0100 Subject: [PATCH] docs: make sample code valid Nix expressions --- lib/fixed-points.nix | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/fixed-points.nix b/lib/fixed-points.nix index ccc897755c11..1de5351d95aa 100644 --- a/lib/fixed-points.nix +++ b/lib/fixed-points.nix @@ -160,7 +160,9 @@ rec { A fixed-point function returning an attribute set has the form ```nix - final: { # attributes } + final: { + # attributes + } ``` where `final` refers to the lazily evaluated attribute set returned by the fixed-point function. @@ -168,7 +170,9 @@ rec { An overlay to such a fixed-point function has the form ```nix - final: prev: { # attributes } + final: prev: { + # attributes + } ``` where `prev` refers to the result of the original function to `final`, and `final` is the result of the composition of the overlay and the original function. @@ -177,8 +181,12 @@ rec { ```nix let - f = final: { # attributes }; - overlay = final: prev: { # attributes }; + f = final: { + # attributes + }; + overlay = final: prev: { + # attributes + }; in extends overlay f; ``` @@ -186,8 +194,12 @@ rec { ```nix let - f = final: { # attributes }; - overlay = final: prev: { # attributes }; + f = final: { + # attributes + }; + overlay = final: prev: { + # attributes + }; g = extends overlay f; in fix g ```