antora-lunr-extension: init at 1.0.0-alpha.8
Link: https://github.com/NixOS/nixpkgs/pull/332341
This commit is contained in:
parent
d5443c9174
commit
6248c46b27
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;
|
||||
};
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
{
|
||||
antora,
|
||||
antora-lunr-extension,
|
||||
antora-lunr-extension-test ? false,
|
||||
antora-ui-default,
|
||||
gitMinimal,
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "${antora.pname}-test";
|
||||
name = "${antora.pname}${lib.optionalString antora-lunr-extension-test "-${antora-lunr-extension.pname}"}-test";
|
||||
src = ./minimal_working_example;
|
||||
|
||||
postPatch =
|
||||
@ -43,6 +45,7 @@ stdenvNoCC.mkDerivation {
|
||||
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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user