From be112ea232cdda22f561da7949ae496ea2cea280 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 4 Nov 2024 20:54:08 +0000 Subject: [PATCH] refactor: docsets: split `make-docset-index` into its own package so i can (in the future) use it for other docsets --- .../make-docset-index} | 4 ++-- pkgs/by-name/docsets/make-docset-index/package.nix | 7 +++++++ pkgs/by-name/docsets/nixpkgs-lib/package.nix | 12 ++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) rename pkgs/by-name/docsets/{nixpkgs-lib/generate_index => make-docset-index/make-docset-index} (95%) create mode 100644 pkgs/by-name/docsets/make-docset-index/package.nix diff --git a/pkgs/by-name/docsets/nixpkgs-lib/generate_index b/pkgs/by-name/docsets/make-docset-index/make-docset-index similarity index 95% rename from pkgs/by-name/docsets/nixpkgs-lib/generate_index rename to pkgs/by-name/docsets/make-docset-index/make-docset-index index c5362384f..53d9368a9 100755 --- a/pkgs/by-name/docsets/nixpkgs-lib/generate_index +++ b/pkgs/by-name/docsets/make-docset-index/make-docset-index @@ -73,8 +73,8 @@ def register_section(db, attrpath: str) -> None: def main() -> None: logging.basicConfig() - parser = argparse.ArgumentParser(description = "Generate Dash/Zeal docset index for use with nixpkgs html manual") - parser.add_argument("locations", type=Path, help="path to locations.json, a dict mapping attrpath to code location for all nixpkgs.lib attrs") + parser = argparse.ArgumentParser(description = "Generate Dash/Zeal docset index for use with an existing HTML manual") + parser.add_argument("locations", type=Path, help="path to locations.json, a dict mapping attrpath to code location for all attrpaths that should be linked into the docs") parser.add_argument("--output", type=Path) parser.add_argument("--verbose", action="store_true") diff --git a/pkgs/by-name/docsets/make-docset-index/package.nix b/pkgs/by-name/docsets/make-docset-index/package.nix new file mode 100644 index 000000000..b719a8444 --- /dev/null +++ b/pkgs/by-name/docsets/make-docset-index/package.nix @@ -0,0 +1,7 @@ +{ + static-nix-shell, +}: +static-nix-shell.mkPython3 { + pname = "make-docset-index"; + srcRoot = ./.; +} diff --git a/pkgs/by-name/docsets/nixpkgs-lib/package.nix b/pkgs/by-name/docsets/nixpkgs-lib/package.nix index 76c195b2d..75b44b84e 100644 --- a/pkgs/by-name/docsets/nixpkgs-lib/package.nix +++ b/pkgs/by-name/docsets/nixpkgs-lib/package.nix @@ -3,9 +3,9 @@ # - # - { + docsets, lib, nixpkgs-manual, - static-nix-shell, stdenv, }: let @@ -17,16 +17,12 @@ let cp locations.json $out/locations.json ''; }); - generate_index = static-nix-shell.mkPython3 { - pname = "generate_index"; - srcRoot = ./.; - }; docset = stdenv.mkDerivation { pname = "nixpkgs-lib"; version = lib.version; - nativeBuildInputs = [ generate_index ]; + nativeBuildInputs = [ docsets.make-docset-index ]; unpackPhase = '' cp ${./Info.plist} Info.plist @@ -41,7 +37,7 @@ let cp Info.plist nixpkgs-lib.docset/Contents/ cp -R nixpkgs-manual nixpkgs-lib.docset/Contents/Resources/Documents - generate_index --verbose locations.json --output nixpkgs-lib.docset/Contents/Resources/docSet.dsidx + make-docset-index --verbose locations.json --output nixpkgs-lib.docset/Contents/Resources/docSet.dsidx runHook postBuild ''; @@ -53,7 +49,7 @@ let ''; passthru = { - inherit generate_index lib-locations; + inherit lib-locations; }; }; in