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
# `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.<system>.docs` derivation so the per-system eval
# of `nix/docs.nix` happens once.
inherit (self.packages.${system}) docs;
}
);
};

View file

@ -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);