From 7042d2b31b5cdca1454555332dd19e8f759e6678 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sun, 28 Jun 2026 22:38:10 -0500 Subject: [PATCH] lib/nix: use locked nixpkgs for maintainer extraction Importing tied extraction to the caller's NIX_PATH. When that channel lacks a maintainer referenced through `with lib.maintainers` (such as sherlock's `_74k1`, which exists in the locked nixpkgs but not in an older channel), evaluation fails outright and the generated list varies by machine. Resolve nixpkgs from flake.lock so extraction matches what Home Manager builds with. Also classify maintainers by identity (github/name) rather than attribute name so renamed entries like `_9p4` still match, and correct the arguments passed to the manual derivation so its maintainer is collected. --- lib/nix/extract-maintainers-meta.nix | 55 ++++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/nix/extract-maintainers-meta.nix b/lib/nix/extract-maintainers-meta.nix index de9a0cc66..09a9e4025 100644 --- a/lib/nix/extract-maintainers-meta.nix +++ b/lib/nix/extract-maintainers-meta.nix @@ -1,7 +1,14 @@ # Extract maintainers from Home Manager modules using meta.maintainers # This script evaluates all Home Manager modules and extracts the merged maintainer information let - pkgs = import { }; + flakeLock = builtins.fromJSON (builtins.readFile ../../flake.lock); + nixpkgsNodeName = flakeLock.nodes.root.inputs.nixpkgs; + nixpkgsLocked = flakeLock.nodes.${nixpkgsNodeName}.locked; + + pkgs = import (fetchTarball { + url = "https://github.com/${nixpkgsLocked.owner}/${nixpkgsLocked.repo}/archive/${nixpkgsLocked.rev}.tar.gz"; + sha256 = nixpkgsLocked.narHash; + }) { }; lib = import ../../modules/lib/stdlib-extended.nix pkgs.lib; releaseInfo = pkgs.lib.importJSON ../../release.json; @@ -25,18 +32,23 @@ let file: let fileContent = import file; + # Arguments expected by docs/home-manager-manual.nix. evaluated = if lib.isFunction fileContent then fileContent { - inherit (pkgs) stdenv lib; - documentation-highlighter = { }; + inherit lib; + inherit (pkgs) + callPackage + mdbook + python3 + stdenv + ; revision = "unknown"; home-manager-options = { home-manager = { }; nixos = { }; nix-darwin = { }; }; - nixos-render-docs = { }; } else fileContent; @@ -59,27 +71,30 @@ let allMaintainerObjects = extractMaintainerObjects maintainers ++ additionalMaintainerObjects; - allMaintainerNames = lib.filter (name: name != null) ( - map (maintainer: maintainer.github or maintainer.name or null) allMaintainerObjects - ); + getMaintainerName = maintainer: maintainer.github or maintainer.name or null; + + allMaintainerNames = lib.filter (name: name != null) (map getMaintainerName allMaintainerObjects); hmMaintainers = import ../../modules/lib/maintainers.nix; - hmMaintainerNames = lib.attrNames hmMaintainers; + hmMaintainerNames = lib.filter (name: name != null) ( + map getMaintainerName (lib.attrValues hmMaintainers) + ); maintainerDetails = lib.pipe allMaintainerObjects [ (lib.filter (obj: (obj.github or obj.name or null) != null)) - (map (obj: { - name = obj.github or obj.name; - value = obj // { - source = - if categorizedMaintainers.home-manager ? ${obj.github} then - "home-manager" - else if categorizedMaintainers.nixpkgs ? ${obj.github} then - "nixpkgs" - else - throw "${obj.github} is neither a home-manager or nixpkgs maintainer"; - }; - })) + (map ( + obj: + let + maintainerName = obj.github or obj.name; + in + { + name = maintainerName; + value = obj // { + source = + if categorizedMaintainers.home-manager ? ${maintainerName} then "home-manager" else "nixpkgs"; + }; + } + )) lib.listToAttrs ];