From 24f61f33869a6a5d36dc3027e6b76150f41c24e5 Mon Sep 17 00:00:00 2001 From: atlas Date: Fri, 29 May 2026 23:46:39 +0200 Subject: [PATCH] nix/docs: drop dead `walk` helper + dedupe checks.docs eval argus review notes on #618: - `walk` in `pickSubtrees` was leftover from an earlier traversal design; `pick` does everything we need. drop it. - `checks.docs` was re-importing `nix/docs.nix` independently of `packages.docs`; the comment claimed they shared eval but they didn't (nix's lazy eval + import caching made the *result* identical, not the eval). switch to `inherit (self.packages.\${system}) docs;` so the check is literally the package output, no second import. --- flake.nix | 14 ++++---------- nix/docs.nix | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index f0804f7a..ad424a7e 100644 --- a/flake.nix +++ b/flake.nix @@ -347,16 +347,10 @@ # Nix options docs evaluation (#616). Cheap: pulls in # `nixosOptionsDoc` + the host module's stub eval, no rust or # frontend deps. CI fails fast if a module change breaks - # option declarations or the doc rendering. `docs-host` + - # `docs-agent` are exposed as `packages` outputs (not checks) - # — they share this eval, so building the bundle here covers - # both surfaces in one shot. - docs = - (import ./nix/docs.nix { - inherit pkgs self; - inherit (nixpkgs) lib; - inherit (nixpkgs.lib) nixosSystem; - }).bundle; + # option declarations or the doc rendering. Reuses the + # `packages..docs` derivation so the per-system eval + # of `nix/docs.nix` happens once. + inherit (self.packages.${system}) docs; } ); }; diff --git a/nix/docs.nix b/nix/docs.nix index ba222889..c4427c94 100644 --- a/nix/docs.nix +++ b/nix/docs.nix @@ -90,18 +90,12 @@ let pickSubtrees = options: roots: let - walk = - path: tree: - if path == [ ] then - lib.getAttrFromPath path options - else - lib.setAttrByPath path (lib.getAttrFromPath path tree); pick = path: - let - exists = lib.hasAttrByPath path options; - in - if exists then lib.setAttrByPath path (lib.getAttrFromPath path options) else { }; + if lib.hasAttrByPath path options then + lib.setAttrByPath path (lib.getAttrFromPath path options) + else + { }; in lib.foldl' lib.recursiveUpdate { } (map pick roots);