antora-lunr-extension: init at 1.0.0-alpha.8 (#332341)
This commit is contained in:
commit
706955fadb
@ -15057,6 +15057,12 @@
|
||||
name = "Daniel Nagy";
|
||||
keys = [ { fingerprint = "F6AE 2C60 9196 A1BC ECD8 7108 1B8E 8DCB 576F B671"; } ];
|
||||
};
|
||||
naho = {
|
||||
github = "trueNAHO";
|
||||
githubId = 90870942;
|
||||
name = "Noah Pierre Biewesch";
|
||||
keys = [ { fingerprint = "5FC6 088A FB1A 609D 4532 F919 0C1C 177B 3B64 68E0"; } ];
|
||||
};
|
||||
nalbyuites = {
|
||||
email = "ashijit007@gmail.com";
|
||||
github = "nalbyuites";
|
||||
|
63
pkgs/by-name/an/antora-lunr-extension/package.nix
Normal file
63
pkgs/by-name/an/antora-lunr-extension/package.nix
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
antora,
|
||||
buildNpmPackage,
|
||||
fetchFromGitLab,
|
||||
lib,
|
||||
nix-update-script,
|
||||
}:
|
||||
buildNpmPackage rec {
|
||||
pname = "antora-lunr-extension";
|
||||
version = "1.0.0-alpha.8";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
hash = "sha256-GplCwhUl8jurD4FfO6/T3Vo1WFjg+rtAjWeIh35unk4=";
|
||||
owner = "antora";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-EtjZL6U/uSGSYSqtuatCkdWP0NHxRuht13D9OaM4x00=";
|
||||
|
||||
# Prevent tests from failing because they are fetching data at runtime.
|
||||
postPatch = ''
|
||||
substituteInPlace package.json --replace '"_mocha"' '""'
|
||||
'';
|
||||
|
||||
# Pointing $out to $out/lib/node_modules/@antora/lunr-extension simplifies
|
||||
# Antora's extension option usage from
|
||||
#
|
||||
# --extension ${pkgs.antora-lunr-extension}/lib/node_modules/@antora/lunr-extension
|
||||
#
|
||||
# to
|
||||
#
|
||||
# --extension ${pkgs.antora-lunr-extension}
|
||||
postInstall = ''
|
||||
directory="$(mktemp --directory)"
|
||||
|
||||
mv "$out/"{.,}* "$directory"
|
||||
mv "$directory/lib/node_modules/@antora/lunr-extension/"{.,}* "$out"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests.run = antora.tests.run.override {
|
||||
antora-lunr-extension-test = true;
|
||||
};
|
||||
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Antora extension adding offline, full-text search powered by Lunr";
|
||||
homepage = "https://gitlab.com/antora/antora-lunr-extension";
|
||||
license = lib.licenses.mpl20;
|
||||
|
||||
longDescription = ''
|
||||
This Antora extension is intended to be passed to `antora`'s `--extension`
|
||||
flag or injected into the [`antora.extensions`
|
||||
key](https://docs.antora.org/antora/3.1/extend/enable-extension).
|
||||
'';
|
||||
|
||||
maintainers = [ lib.maintainers.naho ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
79
pkgs/by-name/an/antora-ui-default/package.nix
Normal file
79
pkgs/by-name/an/antora-ui-default/package.nix
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
fetchFromGitLab,
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
let
|
||||
srcFetchFromGitLab = {
|
||||
hash = "sha256-q2FwkwzjanxTIxjMpCyMpzPt782uYZiWVdZ7Eev79oM=";
|
||||
owner = "trueNAHO";
|
||||
repo = "antora-ui-default";
|
||||
rev = "83bf9bf5f22a6dee397f8b089eb0315c14a278b5";
|
||||
};
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "antora-ui-default";
|
||||
version = "0";
|
||||
|
||||
# The UI bundle is fetched from lib.maintainers.naho's antora-ui-default fork
|
||||
# for the following reasons:
|
||||
#
|
||||
# > The UI bundle is currently unpackaged [1] [2], and only accessible by
|
||||
# > fetching the latest GitLab artifact or building from source. Neither
|
||||
# > method is reliably reproducible, as artifacts are deleted over time and
|
||||
# > building from source requires insecure Node 10.
|
||||
# >
|
||||
# > The solution is to version control the UI bundle.
|
||||
# >
|
||||
# > [...]
|
||||
# >
|
||||
# > [1]: https://gitlab.com/antora/antora-ui-default/-/issues/135
|
||||
# > [2]: https://gitlab.com/antora/antora-ui-default/-/issues/211
|
||||
# >
|
||||
# > -- [3]
|
||||
#
|
||||
# To avoid bloating the repository archive size, the UI bundle is not stored
|
||||
# in Nixpkgs.
|
||||
#
|
||||
# For reference, the UI bundle from [3] is 300K large.
|
||||
#
|
||||
# [3]: https://gitlab.com/trueNAHO/antora-ui-default/-/commit/83bf9bf5f22a6dee397f8b089eb0315c14a278b5
|
||||
src = fetchFromGitLab srcFetchFromGitLab;
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
# Install '$src/ui-bundle.zip' to '$out/ui-bundle.zip' instead of '$out' to
|
||||
# prevent the ZIP from being misidentified as a binary [1].
|
||||
#
|
||||
# [1]: https://github.com/NixOS/nixpkgs/blob/8885a1e21ad43f8031c738a08029cd1d4dcbc2f7/pkgs/stdenv/generic/setup.sh#L792-L795
|
||||
installPhase = ''
|
||||
mkdir --parents "$out"
|
||||
cp "$src/ui-bundle.zip" "$out"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Antora default UI bundle";
|
||||
homepage = "https://gitlab.com/antora/antora-ui-default";
|
||||
license = lib.licenses.mpl20;
|
||||
|
||||
longDescription = ''
|
||||
> A UI bundle is a [ZIP
|
||||
> archive](https://en.wikipedia.org/wiki/Zip_(file_format)) or directory
|
||||
> that contains one or more UIs for a site.
|
||||
>
|
||||
> -- Antora
|
||||
> https://docs.antora.org/antora/3.1/playbook/ui-bundle-url
|
||||
|
||||
This UI bundle is available under `$out/ui-bundle.zip` and intended to be
|
||||
passed to `antora`'s `--ui-bundle-url` flag or injected into the
|
||||
[`ui.bundle.url`
|
||||
key](https://docs.antora.org/antora/3.1/playbook/ui-bundle-url/#url-key)
|
||||
to avoid irreproducible
|
||||
[`https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable`](https://gitlab.com/${srcFetchFromGitLab.owner}/${srcFetchFromGitLab.repo}/-/blob/${srcFetchFromGitLab.rev}/README.adoc#user-content-use-the-default-ui)
|
||||
references.
|
||||
'';
|
||||
|
||||
maintainers = [ lib.maintainers.naho ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
@ -1,4 +1,10 @@
|
||||
{ lib, buildNpmPackage, fetchFromGitLab }:
|
||||
{
|
||||
buildNpmPackage,
|
||||
callPackage,
|
||||
fetchFromGitLab,
|
||||
lib,
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
buildNpmPackage rec {
|
||||
pname = "antora";
|
||||
@ -24,11 +30,22 @@ buildNpmPackage rec {
|
||||
ln -s $out/lib/node_modules/antora-build/packages/cli/bin/antora $out/bin/antora
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests.run = callPackage ./test { };
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Modular documentation site generator. Designed for users of Asciidoctor";
|
||||
mainProgram = "antora";
|
||||
homepage = "https://antora.org";
|
||||
license = licenses.mpl20;
|
||||
maintainers = [ maintainers.ehllie ];
|
||||
mainProgram = "antora";
|
||||
|
||||
maintainers = with maintainers; [
|
||||
ehllie
|
||||
naho
|
||||
];
|
||||
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
66
pkgs/by-name/an/antora/test/default.nix
Normal file
66
pkgs/by-name/an/antora/test/default.nix
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
antora,
|
||||
antora-lunr-extension,
|
||||
antora-lunr-extension-test ? false,
|
||||
antora-ui-default,
|
||||
gitMinimal,
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "${antora.pname}${lib.optionalString antora-lunr-extension-test "-${antora-lunr-extension.pname}"}-test";
|
||||
src = ./minimal_working_example;
|
||||
|
||||
postPatch =
|
||||
let
|
||||
date = lib.escapeShellArg "1/1/1970 00:00:00 +0000";
|
||||
in
|
||||
''
|
||||
# > In order to use a local content repository with Antora, even when using
|
||||
# > the worktree (HEAD), the repository must have at least one commit.
|
||||
# >
|
||||
# > -- https://docs.antora.org/antora/3.1/playbook/content-source-url
|
||||
git init &&
|
||||
GIT_AUTHOR_DATE=${date} \
|
||||
GIT_AUTHOR_EMAIL= \
|
||||
GIT_AUTHOR_NAME=Nixpkgs \
|
||||
GIT_COMMITTER_DATE=${date} \
|
||||
GIT_COMMITTER_EMAIL= \
|
||||
GIT_COMMITTER_NAME=Nixpkgs \
|
||||
git commit --allow-empty --allow-empty-message --message ""
|
||||
'';
|
||||
|
||||
buildPhase =
|
||||
let
|
||||
playbook = builtins.toFile "antora-playbook.json" (
|
||||
builtins.toJSON {
|
||||
content.sources = [ { url = "~+"; } ];
|
||||
runtime.log.failure_level = "warn";
|
||||
}
|
||||
);
|
||||
in
|
||||
''
|
||||
# The --to-dir and --ui-bundle-url options are not included in the
|
||||
# playbook due to Antora and Nix limitations.
|
||||
antora ${
|
||||
lib.cli.toGNUCommandLineShell { } {
|
||||
cache-dir = "$(mktemp --directory)";
|
||||
extension = if antora-lunr-extension-test then antora-lunr-extension else false;
|
||||
to-dir = placeholder "out";
|
||||
ui-bundle-url = "${antora-ui-default}/ui-bundle.zip";
|
||||
}
|
||||
} "${playbook}"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
antora
|
||||
gitMinimal
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Reproducible Antora test framework";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ lib.maintainers.naho ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
name: Antora
|
||||
|
||||
nav:
|
||||
- modules/ROOT/nav.adoc
|
||||
|
||||
version: ~
|
@ -0,0 +1 @@
|
||||
* xref:index.adoc[]
|
@ -0,0 +1,3 @@
|
||||
= Antora
|
||||
|
||||
== Minimal Working Example
|
@ -2998,8 +2998,6 @@ with pkgs;
|
||||
|
||||
ansifilter = callPackage ../tools/text/ansifilter { };
|
||||
|
||||
antora = callPackage ../development/tools/documentation/antora { };
|
||||
|
||||
apfs-fuse = callPackage ../tools/filesystems/apfs-fuse { };
|
||||
|
||||
apk-tools = callPackage ../tools/package-management/apk-tools {
|
||||
|
Loading…
Reference in New Issue
Block a user