antora: verify core functionality with a minimal working example

Link: https://github.com/NixOS/nixpkgs/pull/332341

NAHO d5443c91 c5f5cc35

+79 -1
+5 -1
pkgs/by-name/an/antora/package.nix
··· 1 1 { 2 2 buildNpmPackage, 3 + callPackage, 3 4 fetchFromGitLab, 4 5 lib, 5 6 nix-update-script, ··· 29 30 ln -s $out/lib/node_modules/antora-build/packages/cli/bin/antora $out/bin/antora 30 31 ''; 31 32 32 - passthru.updateScript = nix-update-script { }; 33 + passthru = { 34 + tests.run = callPackage ./test { }; 35 + updateScript = nix-update-script { }; 36 + }; 33 37 34 38 meta = with lib; { 35 39 description = "Modular documentation site generator. Designed for users of Asciidoctor";
+63
pkgs/by-name/an/antora/test/default.nix
··· 1 + { 2 + antora, 3 + antora-ui-default, 4 + gitMinimal, 5 + lib, 6 + stdenvNoCC, 7 + }: 8 + stdenvNoCC.mkDerivation { 9 + name = "${antora.pname}-test"; 10 + src = ./minimal_working_example; 11 + 12 + postPatch = 13 + let 14 + date = lib.escapeShellArg "1/1/1970 00:00:00 +0000"; 15 + in 16 + '' 17 + # > In order to use a local content repository with Antora, even when using 18 + # > the worktree (HEAD), the repository must have at least one commit. 19 + # > 20 + # > -- https://docs.antora.org/antora/3.1/playbook/content-source-url 21 + git init && 22 + GIT_AUTHOR_DATE=${date} \ 23 + GIT_AUTHOR_EMAIL= \ 24 + GIT_AUTHOR_NAME=Nixpkgs \ 25 + GIT_COMMITTER_DATE=${date} \ 26 + GIT_COMMITTER_EMAIL= \ 27 + GIT_COMMITTER_NAME=Nixpkgs \ 28 + git commit --allow-empty --allow-empty-message --message "" 29 + ''; 30 + 31 + buildPhase = 32 + let 33 + playbook = builtins.toFile "antora-playbook.json" ( 34 + builtins.toJSON { 35 + content.sources = [ { url = "~+"; } ]; 36 + runtime.log.failure_level = "warn"; 37 + } 38 + ); 39 + in 40 + '' 41 + # The --to-dir and --ui-bundle-url options are not included in the 42 + # playbook due to Antora and Nix limitations. 43 + antora ${ 44 + lib.cli.toGNUCommandLineShell { } { 45 + cache-dir = "$(mktemp --directory)"; 46 + to-dir = placeholder "out"; 47 + ui-bundle-url = "${antora-ui-default}/ui-bundle.zip"; 48 + } 49 + } "${playbook}" 50 + ''; 51 + 52 + nativeBuildInputs = [ 53 + antora 54 + gitMinimal 55 + ]; 56 + 57 + meta = { 58 + description = "Reproducible Antora test framework"; 59 + license = lib.licenses.mit; 60 + maintainers = [ lib.maintainers.naho ]; 61 + platforms = lib.platforms.all; 62 + }; 63 + }
+7
pkgs/by-name/an/antora/test/minimal_working_example/antora.yml
··· 1 + --- 2 + name: Antora 3 + 4 + nav: 5 + - modules/ROOT/nav.adoc 6 + 7 + version: ~
+1
pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/nav.adoc
··· 1 + * xref:index.adoc[]
+3
pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/pages/index.adoc
··· 1 + = Antora 2 + 3 + == Minimal Working Example