From 2eae7d63e29c74afb9bca17746528dc62ba5486d Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 30 Dec 2024 20:09:11 +0000 Subject: [PATCH] nixpkgs-manual: avoid `lib.fileset` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t love this, and I’m not convinced it doesn’t have the same pitfalls as filesets, but see the `flattenReferencesGraph` commit for reasoning. It may be better to ban the relevant builtins entirely and just move things into subdirectories when needed, but I didn’t want to do more surgery to this part of the tree than necessary to solve the immediate problem. --- doc/doc-support/lib-function-docs.nix | 7 +++---- doc/doc-support/package.nix | 26 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/doc/doc-support/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix index 51b4601975c3..9a2f0667dd60 100644 --- a/doc/doc-support/lib-function-docs.nix +++ b/doc/doc-support/lib-function-docs.nix @@ -90,10 +90,7 @@ stdenvNoCC.mkDerivation { name = "nixpkgs-lib-docs"; - src = lib.fileset.toSource { - root = ../..; - fileset = ../../lib; - }; + src = ../../lib; nativeBuildInputs = [ nixdoc @@ -101,6 +98,8 @@ stdenvNoCC.mkDerivation { ]; installPhase = '' + cd .. + export NIX_STATE_DIR=$(mktemp -d) nix-instantiate --eval --strict --json ${./lib-function-locations.nix} \ --arg nixpkgsPath "./." \ diff --git a/doc/doc-support/package.nix b/doc/doc-support/package.nix index c2bbdf09e533..bc5566f3cbd3 100644 --- a/doc/doc-support/package.nix +++ b/doc/doc-support/package.nix @@ -25,16 +25,22 @@ stdenvNoCC.mkDerivation ( nativeBuildInputs = [ nixos-render-docs ]; - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions [ - (lib.fileset.fileFilter (file: file.hasExt "md" || file.hasExt "md.in") ../.) - ../style.css - ../anchor-use.js - ../anchor.min.js - ../manpage-urls.json - ../redirects.json - ]; + src = lib.cleanSourceWith { + src = ../.; + filter = + path: type: + type == "directory" + || lib.hasSuffix ".md" path + || lib.hasSuffix ".md.in" path + || lib.elem path ( + map toString [ + ../style.css + ../anchor-use.js + ../anchor.min.js + ../manpage-urls.json + ../redirects.json + ] + ); }; postPatch = ''