diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index 858ccd58c..2ea88c1a0 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -39,6 +39,7 @@ ./dino.nix ./discord.nix ./dissent.nix + ./docsets.nix ./dtrx.nix ./eg25-control.nix ./eg25-manager.nix diff --git a/hosts/common/programs/docsets.nix b/hosts/common/programs/docsets.nix new file mode 100644 index 000000000..752ae730d --- /dev/null +++ b/hosts/common/programs/docsets.nix @@ -0,0 +1,53 @@ +# 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; + configOpts = with lib; types.submodule { + options = { + rustPkgs = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + }; + }; +in { + sane.programs.docsets = { + configOption = with lib; mkOption { + type = configOpts; + default = {}; + }; + packageUnwrapped = pkgs.symlinkJoin { + name = "docsets"; + # build each package with rust docs + paths = builtins.map (name: + let + orig = pkgs."${name}"; + withDocs = orig.overrideAttrs (upstream: { + nativeBuildInputs = upstream.nativeBuildInputs or [] ++ [ + pkgs.cargoDocsetHook + ]; + }); + in + "${toString withDocs}/share/docset" + ) cfg.config.rustPkgs; + # link only the docs (not any binaries) + postBuild = '' + mkdir -p $out/share/docset + ${lib.optionalString (cfg.config.rustPkgs != []) '' + mv $out/*.docset $out/share/docset + ''} + ''; + }; + sandbox.enable = false; # meta-package; no binaries + }; + + environment.pathsToLink = lib.mkIf cfg.enabled [ + "/share/docset" + ]; +} diff --git a/hosts/common/programs/zeal.nix b/hosts/common/programs/zeal.nix index 29a825c20..215b91862 100644 --- a/hosts/common/programs/zeal.nix +++ b/hosts/common/programs/zeal.nix @@ -1,20 +1,4 @@ -# TODO -# - package Nix/NixOS docs for Zeal -# - install [doc-browser](https://github.com/qwfy/doc-browser) -# - this supports both dash (zeal) *and* the datasets from (which includes nix!) -# - install [devhelp](https://wiki.gnome.org/Apps/Devhelp) (gnome) -{ config, lib, pkgs, ... }: -let - cfg = config.sane.programs.docsets.config; - configOpts = with lib; types.submodule { - options = { - rustPkgs = mkOption { - type = types.listOf types.str; - default = [ ]; - }; - }; - }; -in { +{ pkgs, ... }: { sane.programs.zeal = { # packageUnwrapped = pkgs.zeal-qt6; #< TODO: upgrade system to qt6 versions of everything (i.e. jellyfin-media-player, nheko) packageUnwrapped = pkgs.zeal-qt5; @@ -26,37 +10,4 @@ in { fs.".local/share/Zeal/Zeal/docsets/system".symlink.target = "/run/current-system/sw/share/docset"; suggestedPrograms = [ "docsets" ]; }; - - sane.programs.docsets = { - configOption = with lib; mkOption { - type = configOpts; - default = {}; - }; - packageUnwrapped = pkgs.symlinkJoin { - name = "docsets"; - # build each package with rust docs - paths = builtins.map (name: - let - orig = pkgs."${name}"; - withDocs = orig.overrideAttrs (upstream: { - nativeBuildInputs = upstream.nativeBuildInputs or [] ++ [ - pkgs.cargoDocsetHook - ]; - }); - in - "${toString withDocs}/share/docset" - ) cfg.rustPkgs; - # link only the docs (not any binaries) - postBuild = lib.optionalString (cfg.rustPkgs != []) '' - mkdir -p $out/share/docset - mv $out/*.docset $out/share/docset - ''; - }; - - sandbox.enable = false; # meta-package; no binaries - }; - - environment.pathsToLink = lib.mkIf config.sane.programs.zeal.enabled [ - "/share/docset" - ]; }