From 09aee329cf73b850bafd36a8810ff90532544a78 Mon Sep 17 00:00:00 2001 From: alexion Date: Fri, 28 Aug 2026 10:18:34 -0400 Subject: [PATCH] docs(nix): remove unobserved let rule --- docs/nix.md | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/docs/nix.md b/docs/nix.md index 995deab..3b62482 100644 --- a/docs/nix.md +++ b/docs/nix.md @@ -154,31 +154,6 @@ in lib.genAttrs hostNames mkHost ``` -### Bind shared expressions once - -Use a `let` binding when sibling expressions depend on the same derived value. - -Avoid: - -```nix -{ - hostNames = lib.attrNames hosts; - hostCount = lib.length (lib.attrNames hosts); -} -``` - -Use: - -```nix -let - hostNames = lib.attrNames hosts; -in -{ - inherit hostNames; - hostCount = lib.length hostNames; -} -``` - ### Keep bindings in the smallest scope Place a `let` binding inside the expression that consumes it.