antora: repackage using buildNpmPackage

This commit is contained in:
Elizabeth Paź 2023-05-02 20:03:38 +02:00 committed by Sandro Jäckel
parent 75b4d0ff2b
commit 5d907dda7c
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
4 changed files with 34 additions and 107 deletions

View File

@ -33,7 +33,8 @@ let
aliases;
in
mapAliases ({
mapAliases {
"@antora/cli" = pkgs.antora;
"@githubnext/github-copilot-cli" = pkgs.github-copilot-cli; # Added 2023-05-02
"@nestjs/cli" = pkgs.nest-cli;
})
}

View File

@ -1,8 +1,6 @@
[
"@angular/cli"
, "@antfu/ni"
, "@antora/cli"
, "@antora/site-generator-default"
, "@astrojs/language-server"
, "@bitwarden/cli"
, "@commitlint/cli"

View File

@ -85851,87 +85851,6 @@ in
bypassCache = true;
reconstructLock = true;
};
"@antora/cli" = nodeEnv.buildNodePackage {
name = "_at_antora_slash_cli";
packageName = "@antora/cli";
version = "3.1.3";
src = fetchurl {
url = "https://registry.npmjs.org/@antora/cli/-/cli-3.1.3.tgz";
sha512 = "ABngPywk4yZfUE/gaej7ApFeB/0cr5bkW7S4wqObzU5m29q2wDcvrtn/c2mrzFSeSDNAf9y7RCRnudAV5SteBA==";
};
dependencies = [
sources."@antora/expand-path-helper-2.0.0"
sources."@antora/logger-3.1.3"
sources."@antora/playbook-builder-3.1.3"
sources."@antora/user-require-helper-2.0.0"
sources."@iarna/toml-2.2.5"
sources."abort-controller-3.0.0"
sources."argparse-2.0.1"
sources."atomic-sleep-1.0.0"
sources."balanced-match-1.0.2"
sources."base64-js-1.5.1"
sources."brace-expansion-2.0.1"
sources."buffer-6.0.3"
sources."colorette-2.0.20"
sources."commander-9.4.1"
sources."convict-6.2.4"
sources."dateformat-4.6.3"
sources."end-of-stream-1.4.4"
sources."event-target-shim-5.0.1"
sources."events-3.3.0"
sources."fast-copy-3.0.1"
sources."fast-redact-3.1.2"
sources."fast-safe-stringify-2.1.1"
sources."fs.realpath-1.0.0"
sources."glob-8.1.0"
(sources."help-me-4.2.0" // {
dependencies = [
sources."readable-stream-3.6.2"
];
})
sources."ieee754-1.2.1"
sources."inflight-1.0.6"
sources."inherits-2.0.4"
sources."joycon-3.1.1"
sources."js-yaml-4.1.0"
sources."json5-2.2.3"
sources."lodash.clonedeep-4.5.0"
sources."minimatch-5.1.6"
sources."minimist-1.2.8"
sources."on-exit-leak-free-2.1.0"
sources."once-1.4.0"
sources."pino-8.7.0"
sources."pino-abstract-transport-1.0.0"
sources."pino-pretty-9.1.1"
sources."pino-std-serializers-6.2.0"
sources."process-0.11.10"
sources."process-warning-2.2.0"
sources."pump-3.0.0"
sources."quick-format-unescaped-4.0.4"
sources."readable-stream-4.3.0"
sources."real-require-0.2.0"
sources."safe-buffer-5.2.1"
sources."safe-stable-stringify-2.4.3"
sources."secure-json-parse-2.7.0"
sources."sonic-boom-3.2.1"
sources."split2-4.2.0"
sources."string_decoder-1.3.0"
sources."strip-json-comments-3.1.1"
sources."thread-stream-2.3.0"
sources."util-deprecate-1.0.2"
sources."wrappy-1.0.2"
sources."yargs-parser-20.2.9"
];
buildInputs = globalBuildInputs;
meta = {
description = "The command line interface for Antora.";
homepage = "https://antora.org";
license = "MPL-2.0";
};
production = true;
bypassCache = true;
reconstructLock = true;
};
"@antora/site-generator-default" = nodeEnv.buildNodePackage {
name = "_at_antora_slash_site-generator-default";
packageName = "@antora/site-generator-default";

View File

@ -1,24 +1,33 @@
{ lib, nodePackages }:
{ lib, buildNpmPackage, fetchFromGitLab }:
let
linkNodeDeps = ({ pkg, deps, name ? "" }:
let
targetModule = if name != "" then name else lib.getName pkg;
in nodePackages.${pkg}.override (oldAttrs: {
postInstall = ''
mkdir -p $out/lib/node_modules/${targetModule}/node_modules
${lib.concatStringsSep "\n" (map (dep: ''
ln -s ${nodePackages.${dep}}/lib/node_modules/${lib.getName dep} \
$out/lib/node_modules/${targetModule}/node_modules/${lib.getName dep}
'') deps
)}
'';
})
);
in linkNodeDeps {
pkg = "@antora/cli";
name = "@antora/cli";
deps = [
"@antora/site-generator-default"
];
buildNpmPackage rec {
pname = "antora";
version = "3.1.3";
src = fetchFromGitLab {
owner = pname;
repo = pname;
rev = "v${version}";
hash = "sha256-pOEIARvDXc40sljeyUk51DY6LuhVk7pHfrd9YF5Dsu4=";
};
npmDepsHash = "sha256-G1/AMwCD2OWuAkqz6zGp1lmaiCAyKIdtwqC902hkZGo=";
# This is to stop tests from being ran, as some of them fail due to trying to query remote repositories
postPatch = ''
substituteInPlace package.json --replace \
'"_mocha"' '""'
'';
postInstall = ''
mkdir -p $out/bin
ln -s $out/lib/node_modules/antora-build/packages/cli/bin/antora $out/bin/antora
'';
meta = with lib; {
description = "A modular documentation site generator. Designed for users of Asciidoctor.";
homepage = "https://antora.org";
license = licenses.mpl20;
maintainers = [ maintainers.ehllie ];
};
}