mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
docs/search: refactor to use override
This commit is contained in:
parent
9eb07bb16f
commit
cdbda982f0
2 changed files with 25 additions and 27 deletions
|
@ -50,6 +50,8 @@ let
|
||||||
}).optionsJSON;
|
}).optionsJSON;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
lib.fix (
|
||||||
|
self:
|
||||||
{
|
{
|
||||||
inherit options-json;
|
inherit options-json;
|
||||||
inherit (pkgs) nixos-render-docs;
|
inherit (pkgs) nixos-render-docs;
|
||||||
|
@ -58,27 +60,20 @@ in
|
||||||
|
|
||||||
man-docs = pkgs.callPackage ./man { inherit options-json; };
|
man-docs = pkgs.callPackage ./man { inherit options-json; };
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (!pkgs.stdenv.isDarwin) (
|
// lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
|
||||||
let
|
# NuschtOS/search does not seem to work on darwin
|
||||||
mkSearch =
|
search = nuschtosSearch.packages.mkSearch {
|
||||||
baseHref:
|
|
||||||
nuschtosSearch.packages.mkSearch {
|
|
||||||
optionsJSON = options-json + "/share/doc/nixos/options.json";
|
optionsJSON = options-json + "/share/doc/nixos/options.json";
|
||||||
urlPrefix = "https://github.com/nix-community/nixvim/tree/main";
|
urlPrefix = "https://github.com/nix-community/nixvim/tree/main";
|
||||||
title = "Nixvim options search";
|
title = "Nixvim options search";
|
||||||
inherit baseHref;
|
baseHref = "/";
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
|
||||||
# NuschtOS/search does not seem to work on darwin
|
|
||||||
search = mkSearch "/";
|
|
||||||
|
|
||||||
# Do not check if documentation builds fine on darwin as it fails:
|
# Do not check if documentation builds fine on darwin as it fails:
|
||||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||||
docs = pkgs.callPackage ./mdbook {
|
docs = pkgs.callPackage ./mdbook {
|
||||||
inherit evaledModules transformOptions;
|
inherit evaledModules transformOptions;
|
||||||
# TODO: Find how to handle stable when 24.11 lands
|
inherit (self) search;
|
||||||
search = mkSearch "/nixvim/search/";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
nixosOptionsDoc,
|
nixosOptionsDoc,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
search,
|
search,
|
||||||
|
# The root directory of the site
|
||||||
|
baseHref ? "/nixvim/",
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (evaledModules.config.meta) nixvimInfo;
|
inherit (evaledModules.config.meta) nixvimInfo;
|
||||||
|
@ -323,7 +325,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
# Patch book.toml
|
# Patch book.toml
|
||||||
substituteInPlace ./book.toml \
|
substituteInPlace ./book.toml \
|
||||||
--replace-fail "@SITE_URL@" "$siteURL"
|
--replace-fail "@SITE_URL@" "$baseHref"
|
||||||
|
|
||||||
# Patch SUMMARY.md - which defiens mdBook's table of contents
|
# Patch SUMMARY.md - which defiens mdBook's table of contents
|
||||||
substituteInPlace ./SUMMARY.md \
|
substituteInPlace ./SUMMARY.md \
|
||||||
|
@ -333,12 +335,10 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
mdbook build
|
mdbook build
|
||||||
cp -r ./book/* $dest
|
cp -r ./book/* $dest
|
||||||
mkdir -p $dest/search
|
mkdir -p $dest/search
|
||||||
cp -r ${search}/* $dest/search
|
cp -r ${finalAttrs.passthru.search}/* $dest/search
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# The root directory of the site
|
inherit baseHref;
|
||||||
# Can be overridden, e.g. by CI
|
|
||||||
siteURL = "/nixvim/";
|
|
||||||
|
|
||||||
inherit (mdbook)
|
inherit (mdbook)
|
||||||
nixvimOptionsSummary
|
nixvimOptionsSummary
|
||||||
|
@ -348,5 +348,8 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
copy-docs = pkgs.writeShellScript "copy-docs" docs.commands;
|
copy-docs = pkgs.writeShellScript "copy-docs" docs.commands;
|
||||||
|
search = search.override {
|
||||||
|
baseHref = finalAttrs.baseHref + "search/";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue