refactor: docsets: split make-docset-index into its own package so i can (in the future) use it for other docsets

This commit is contained in:
2024-11-04 20:54:08 +00:00
parent 2824ec96f2
commit be112ea232
3 changed files with 13 additions and 10 deletions

View File

@@ -73,8 +73,8 @@ def register_section(db, attrpath: str) -> None:
def main() -> None: def main() -> None:
logging.basicConfig() logging.basicConfig()
parser = argparse.ArgumentParser(description = "Generate Dash/Zeal docset index for use with nixpkgs html manual") 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 nixpkgs.lib attrs") 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("--output", type=Path)
parser.add_argument("--verbose", action="store_true") parser.add_argument("--verbose", action="store_true")

View File

@@ -0,0 +1,7 @@
{
static-nix-shell,
}:
static-nix-shell.mkPython3 {
pname = "make-docset-index";
srcRoot = ./.;
}

View File

@@ -3,9 +3,9 @@
# - <https://github.com/nixosbrasil/nix-docgen> # - <https://github.com/nixosbrasil/nix-docgen>
# - <https://kapeli.com/docsets#dashDocset> # - <https://kapeli.com/docsets#dashDocset>
{ {
docsets,
lib, lib,
nixpkgs-manual, nixpkgs-manual,
static-nix-shell,
stdenv, stdenv,
}: }:
let let
@@ -17,16 +17,12 @@ let
cp locations.json $out/locations.json cp locations.json $out/locations.json
''; '';
}); });
generate_index = static-nix-shell.mkPython3 {
pname = "generate_index";
srcRoot = ./.;
};
docset = stdenv.mkDerivation { docset = stdenv.mkDerivation {
pname = "nixpkgs-lib"; pname = "nixpkgs-lib";
version = lib.version; version = lib.version;
nativeBuildInputs = [ generate_index ]; nativeBuildInputs = [ docsets.make-docset-index ];
unpackPhase = '' unpackPhase = ''
cp ${./Info.plist} Info.plist cp ${./Info.plist} Info.plist
@@ -41,7 +37,7 @@ let
cp Info.plist nixpkgs-lib.docset/Contents/ cp Info.plist nixpkgs-lib.docset/Contents/
cp -R nixpkgs-manual nixpkgs-lib.docset/Contents/Resources/Documents 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 runHook postBuild
''; '';
@@ -53,7 +49,7 @@ let
''; '';
passthru = { passthru = {
inherit generate_index lib-locations; inherit lib-locations;
}; };
}; };
in in