diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index e568256461f60..c4f46b8bf153b 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -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"; diff --git a/pkgs/by-name/an/antora-lunr-extension/package.nix b/pkgs/by-name/an/antora-lunr-extension/package.nix new file mode 100644 index 0000000000000..c4eb14a9996fa --- /dev/null +++ b/pkgs/by-name/an/antora-lunr-extension/package.nix @@ -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; + }; +} diff --git a/pkgs/by-name/an/antora-ui-default/package.nix b/pkgs/by-name/an/antora-ui-default/package.nix new file mode 100644 index 0000000000000..5c7781488fe4e --- /dev/null +++ b/pkgs/by-name/an/antora-ui-default/package.nix @@ -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; + }; +} diff --git a/pkgs/development/tools/documentation/antora/default.nix b/pkgs/by-name/an/antora/package.nix similarity index 74% rename from pkgs/development/tools/documentation/antora/default.nix rename to pkgs/by-name/an/antora/package.nix index afd694d4d7dee..87653e0cf3300 100644 --- a/pkgs/development/tools/documentation/antora/default.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -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; }; } diff --git a/pkgs/by-name/an/antora/test/default.nix b/pkgs/by-name/an/antora/test/default.nix new file mode 100644 index 0000000000000..ce5e0d5f50bbe --- /dev/null +++ b/pkgs/by-name/an/antora/test/default.nix @@ -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; + }; +} diff --git a/pkgs/by-name/an/antora/test/minimal_working_example/antora.yml b/pkgs/by-name/an/antora/test/minimal_working_example/antora.yml new file mode 100644 index 0000000000000..27c21228abaae --- /dev/null +++ b/pkgs/by-name/an/antora/test/minimal_working_example/antora.yml @@ -0,0 +1,7 @@ +--- +name: Antora + +nav: + - modules/ROOT/nav.adoc + +version: ~ diff --git a/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/nav.adoc b/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/nav.adoc new file mode 100644 index 0000000000000..31f850eebfdb5 --- /dev/null +++ b/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/nav.adoc @@ -0,0 +1 @@ +* xref:index.adoc[] diff --git a/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/pages/index.adoc b/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/pages/index.adoc new file mode 100644 index 0000000000000..67318787446c6 --- /dev/null +++ b/pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/pages/index.adoc @@ -0,0 +1,3 @@ += Antora + +== Minimal Working Example diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 787f20384e3c9..41885e71f464c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {