diff --git a/hosts/common/programs/docsets.nix b/hosts/common/programs/docsets.nix index 172c7e648..804861121 100644 --- a/hosts/common/programs/docsets.nix +++ b/hosts/common/programs/docsets.nix @@ -1,10 +1,6 @@ # a `docset` is an HTML-based archive containing a library or language reference and search index # - originated from Apple/Xcode: # - still in use via Dash/Zeal: -# TODO: -# - package Nix/NixOS docs as a docset -# - see: -# - see: { config, lib, pkgs, ... }: let cfg = config.sane.programs.docsets; @@ -60,6 +56,7 @@ in { ]; sane.programs.docsets.config.pkgs = with pkgs; [ # packages which ship docsets natively: + docsets.lua-std # docsets.gtk docsets.nix-builtins docsets.nixpkgs-lib diff --git a/pkgs/by-name/docsets/lua-std/dashing.json b/pkgs/by-name/docsets/lua-std/dashing.json new file mode 100755 index 000000000..0c4973f78 --- /dev/null +++ b/pkgs/by-name/docsets/lua-std/dashing.json @@ -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" +} diff --git a/pkgs/by-name/docsets/lua-std/package.nix b/pkgs/by-name/docsets/lua-std/package.nix new file mode 100644 index 000000000..f758495e4 --- /dev/null +++ b/pkgs/by-name/docsets/lua-std/package.nix @@ -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 + ''; +}