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.
This commit is contained in:
atlas 2026-05-29 23:46:39 +02:00
commit 24f61f3386
2 changed files with 8 additions and 20 deletions

View file

@ -347,16 +347,10 @@
# Nix options docs evaluation (#616). Cheap: pulls in # Nix options docs evaluation (#616). Cheap: pulls in
# `nixosOptionsDoc` + the host module's stub eval, no rust or # `nixosOptionsDoc` + the host module's stub eval, no rust or
# frontend deps. CI fails fast if a module change breaks # frontend deps. CI fails fast if a module change breaks
# option declarations or the doc rendering. `docs-host` + # option declarations or the doc rendering. Reuses the
# `docs-agent` are exposed as `packages` outputs (not checks) # `packages.<system>.docs` derivation so the per-system eval
# — they share this eval, so building the bundle here covers # of `nix/docs.nix` happens once.
# both surfaces in one shot. inherit (self.packages.${system}) docs;
docs =
(import ./nix/docs.nix {
inherit pkgs self;
inherit (nixpkgs) lib;
inherit (nixpkgs.lib) nixosSystem;
}).bundle;
} }
); );
}; };

View file

@ -90,18 +90,12 @@ let
pickSubtrees = pickSubtrees =
options: roots: options: roots:
let let
walk =
path: tree:
if path == [ ] then
lib.getAttrFromPath path options
else
lib.setAttrByPath path (lib.getAttrFromPath path tree);
pick = pick =
path: path:
let if lib.hasAttrByPath path options then
exists = lib.hasAttrByPath path options; lib.setAttrByPath path (lib.getAttrFromPath path options)
in else
if exists then lib.setAttrByPath path (lib.getAttrFromPath path options) else { }; { };
in in
lib.foldl' lib.recursiveUpdate { } (map pick roots); lib.foldl' lib.recursiveUpdate { } (map pick roots);