Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14731,6 +14731,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";
Expand Down
63 changes: 63 additions & 0 deletions pkgs/by-name/an/antora-lunr-extension/package.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 79 additions & 0 deletions pkgs/by-name/an/antora-ui-default/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
fetchFromGitLab,
lib,
stdenvNoCC,
}:
let
srcFetchFromGitLab = {
hash = "sha256-q2FwkwzjanxTIxjMpCyMpzPt782uYZiWVdZ7Eev79oM=";
owner = "trueNAHO";
repo = "antora-ui-default";
rev = "83bf9bf5f22a6dee397f8b089eb0315c14a278b5";
};
Comment on lines 7 to 12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to pull this into a local. Just use it down below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this use of a let binding feels a little superfluous. Setting it directly inside the fetchFromGitLab call attributes would be a bit clearer.

Copy link
Copy Markdown
Member Author

@trueNAHO trueNAHO Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to #332341 (comment), I will inline the pname value. However, the srcFetchFromGitLab values are also used to generate the following documentation URL:

https://github.com/NixOS/nixpkgs/blob/b63ef6df743c3164c259524875c896273d0008d5/pkgs/by-name/an/antora-ui-default/package.nix#L34

Should I inline all srcFetchFromGitLab instances or only pname?

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;
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{ lib, buildNpmPackage, fetchFromGitLab }:
{
buildNpmPackage,
callPackage,
fetchFromGitLab,
lib,
nix-update-script,
}:

buildNpmPackage rec {
pname = "antora";
Expand All @@ -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 changes: 66 additions & 0 deletions pkgs/by-name/an/antora/test/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Antora

nav:
- modules/ROOT/nav.adoc

version: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* xref:index.adoc[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= Antora

== Minimal Working Example
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3006,8 +3006,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 {
Expand Down