docsets: ship Lua stdlib

This commit is contained in:
2024-11-26 19:36:20 +00:00
parent 0519cafbec
commit 45ce9d2e66
3 changed files with 107 additions and 4 deletions

View File

@@ -1,10 +1,6 @@
# a `docset` is an HTML-based archive containing a library or language reference and search index # a `docset` is an HTML-based archive containing a library or language reference and search index
# - originated from Apple/Xcode: <https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/Documentation_Sets/010-Overview_of_Documentation_Sets/docset_overview.html#//apple_ref/doc/uid/TP40005266-CH13-SW6> # - originated from Apple/Xcode: <https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/Documentation_Sets/010-Overview_of_Documentation_Sets/docset_overview.html#//apple_ref/doc/uid/TP40005266-CH13-SW6>
# - still in use via Dash/Zeal: <https://kapeli.com/dash> # - still in use via Dash/Zeal: <https://kapeli.com/dash>
# TODO:
# - package Nix/NixOS docs as a docset
# - see: <https://github.com/nixosbrasil/nix-docgen>
# - see: <https://gist.github.com/antifuchs/8d946b121fb5dbbf4da01dc05f7d749f>
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.sane.programs.docsets; cfg = config.sane.programs.docsets;
@@ -60,6 +56,7 @@ in {
]; ];
sane.programs.docsets.config.pkgs = with pkgs; [ sane.programs.docsets.config.pkgs = with pkgs; [
# packages which ship docsets natively: # packages which ship docsets natively:
docsets.lua-std
# docsets.gtk # docsets.gtk
docsets.nix-builtins docsets.nix-builtins
docsets.nixpkgs-lib docsets.nixpkgs-lib

View File

@@ -0,0 +1,72 @@
{
"name": "Lua",
"package": "lua",
"index": "index.html",
"selectors": {
"h3 a[name^=\"pdf-\"] code": {
"type": "function",
"regexp": " \\(.*\\)",
"replacement": ""
},
"h2 a": [
{
"type": "module",
"requiretext": "Coroutine Manipulation",
"regexp": ".*",
"replacement": "coroutine"
},
{
"type": "module",
"requiretext": "Modules",
"regexp": ".*",
"replacement": "package"
},
{
"type": "module",
"requiretext": "String Manipulation",
"regexp": ".*",
"replacement": "string"
},
{
"type": "module",
"requiretext": "Table Manipulation",
"regexp": ".*",
"replacement": "table"
},
{
"type": "module",
"requiretext": "Mathematical Functions",
"regexp": ".*",
"replacement": "math"
},
{
"type": "module",
"requiretext": "Bitwise Operations",
"regexp": ".*",
"replacement": "bit32"
},
{
"type": "module",
"requiretext": "Input and Output Facilities",
"regexp": ".*",
"replacement": "io"
},
{
"type": "module",
"requiretext": "Operating System Facilities",
"regexp": ".*",
"replacement": "os"
},
{
"type": "module",
"requiretext": "The Debug Library",
"regexp": ".*",
"replacement": "debug"
}
]
},
"ignore": [],
"icon32x32": "",
"allowJS": false,
"ExternalURL": "https://www.lua.org/docs.html"
}

View File

@@ -0,0 +1,34 @@
{
dashing,
lua,
stdenv,
}:
stdenv.mkDerivation {
pname = "docsets-lua-std";
inherit (lua) version;
src = ./.;
nativeBuildInputs = [ dashing ];
postPatch = ''
cp -R ${lua.doc}/share/doc/* .
'';
buildPhase = ''
runHook preBuild
dashing build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/docsets
cp -R *.docset $out/share/docsets
runHook postInstall
'';
}