refactor: programs: split docsets out of the zeal program
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
./dino.nix
|
||||
./discord.nix
|
||||
./dissent.nix
|
||||
./docsets.nix
|
||||
./dtrx.nix
|
||||
./eg25-control.nix
|
||||
./eg25-manager.nix
|
||||
|
53
hosts/common/programs/docsets.nix
Normal file
53
hosts/common/programs/docsets.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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>
|
||||
# - 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, ... }:
|
||||
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"
|
||||
];
|
||||
}
|
@@ -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 <https://devdocs.io> (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"
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user