From 43a175926f9c884a64355cf733b65ebbaf90a824 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 4 Aug 2024 20:00:53 +0200 Subject: [PATCH 01/10] maintainers: add naho Link: https://github.com/NixOS/nixpkgs/pull/332341 --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index e568256461f6..c4f46b8bf153 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"; From 3108e45ca898acec9e4e0b6b10e953b895631343 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:38:57 +0200 Subject: [PATCH 02/10] antora: move package into pkgs/by-name directory Move the antora package from the deprecated location into the pkgs/by-name directory to regroup future Antora packages. Link: https://github.com/NixOS/nixpkgs/pull/332341 --- .../antora/default.nix => by-name/an/antora/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/tools/documentation/antora/default.nix => by-name/an/antora/package.nix} (100%) diff --git a/pkgs/development/tools/documentation/antora/default.nix b/pkgs/by-name/an/antora/package.nix similarity index 100% rename from pkgs/development/tools/documentation/antora/default.nix rename to pkgs/by-name/an/antora/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 787f20384e3c..41885e71f464 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 { From efc3298775da2b9c6c26c729b6c8217a24460477 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:59:27 +0200 Subject: [PATCH 03/10] antora: reformat with nixfmt Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora/package.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index afd694d4d7de..ffb304b9dc6f 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -1,4 +1,8 @@ -{ lib, buildNpmPackage, fetchFromGitLab }: +{ + lib, + buildNpmPackage, + fetchFromGitLab, +}: buildNpmPackage rec { pname = "antora"; From 915e1b9a5d6bc7f7643b86ebb90f8182d823d2d5 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:01:03 +0200 Subject: [PATCH 04/10] antora: sort entries Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index ffb304b9dc6f..3aec77b2e192 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -1,7 +1,7 @@ { - lib, buildNpmPackage, fetchFromGitLab, + lib, }: buildNpmPackage rec { @@ -30,9 +30,9 @@ buildNpmPackage rec { meta = with lib; { description = "Modular documentation site generator. Designed for users of Asciidoctor"; - mainProgram = "antora"; homepage = "https://antora.org"; license = licenses.mpl20; + mainProgram = "antora"; maintainers = [ maintainers.ehllie ]; }; } From c7b93d24a77ae95d5f77b849936c7cf2f7cf063f Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:43:20 +0200 Subject: [PATCH 05/10] antora: declare meta.platforms --- pkgs/by-name/an/antora/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index 3aec77b2e192..db7bfc78dfeb 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -34,5 +34,6 @@ buildNpmPackage rec { license = licenses.mpl20; mainProgram = "antora"; maintainers = [ maintainers.ehllie ]; + platforms = lib.platforms.all; }; } From 8d93801da996336296d382433c9c9edfddb7061b Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:01:21 +0200 Subject: [PATCH 06/10] antora: declare passthru.updateScript Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index db7bfc78dfeb..23320e04cdd3 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -2,6 +2,7 @@ buildNpmPackage, fetchFromGitLab, lib, + nix-update-script, }: buildNpmPackage rec { @@ -28,6 +29,8 @@ buildNpmPackage rec { ln -s $out/lib/node_modules/antora-build/packages/cli/bin/antora $out/bin/antora ''; + passthru.updateScript = nix-update-script { }; + meta = with lib; { description = "Modular documentation site generator. Designed for users of Asciidoctor"; homepage = "https://antora.org"; From c5f5cc355f8b1823f51973d1ddc679c91002bd9d Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Thu, 12 Sep 2024 22:27:20 +0200 Subject: [PATCH 07/10] antora-ui-default: init at 0 The Antora default UI bundle is intended to be passed to antora's --ui-bundle-url flag or injected into the ui.bundle.url key to avoid irreproducible [1] references. This UI bundle allows writing reproducible Antora tests. [1]: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora-ui-default/package.nix | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 pkgs/by-name/an/antora-ui-default/package.nix 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 000000000000..5c7781488fe4 --- /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; + }; +} From d5443c91746ec7b088643129166c7d9e8666ec5d Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:28:51 +0200 Subject: [PATCH 08/10] antora: verify core functionality with a minimal working example Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora/package.nix | 6 +- pkgs/by-name/an/antora/test/default.nix | 63 +++++++++++++++++++ .../test/minimal_working_example/antora.yml | 7 +++ .../modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/index.adoc | 3 + 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/an/antora/test/default.nix create mode 100644 pkgs/by-name/an/antora/test/minimal_working_example/antora.yml create mode 100644 pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/nav.adoc create mode 100644 pkgs/by-name/an/antora/test/minimal_working_example/modules/ROOT/pages/index.adoc diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index 23320e04cdd3..74a9ca183be6 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -1,5 +1,6 @@ { buildNpmPackage, + callPackage, fetchFromGitLab, lib, nix-update-script, @@ -29,7 +30,10 @@ buildNpmPackage rec { ln -s $out/lib/node_modules/antora-build/packages/cli/bin/antora $out/bin/antora ''; - passthru.updateScript = nix-update-script { }; + passthru = { + tests.run = callPackage ./test { }; + updateScript = nix-update-script { }; + }; meta = with lib; { description = "Modular documentation site generator. Designed for users of Asciidoctor"; 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 000000000000..bc55bfc58808 --- /dev/null +++ b/pkgs/by-name/an/antora/test/default.nix @@ -0,0 +1,63 @@ +{ + antora, + antora-ui-default, + gitMinimal, + lib, + stdenvNoCC, +}: +stdenvNoCC.mkDerivation { + name = "${antora.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)"; + 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 000000000000..27c21228abaa --- /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 000000000000..31f850eebfdb --- /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 000000000000..67318787446c --- /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 From 6248c46b275cd2ce69f473bdb4a083cf143ffe43 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 4 Aug 2024 19:41:18 +0200 Subject: [PATCH 09/10] antora-lunr-extension: init at 1.0.0-alpha.8 Link: https://github.com/NixOS/nixpkgs/pull/332341 --- .../an/antora-lunr-extension/package.nix | 63 +++++++++++++++++++ pkgs/by-name/an/antora/test/default.nix | 5 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/an/antora-lunr-extension/package.nix 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 000000000000..c4eb14a9996f --- /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/test/default.nix b/pkgs/by-name/an/antora/test/default.nix index bc55bfc58808..ce5e0d5f50bb 100644 --- a/pkgs/by-name/an/antora/test/default.nix +++ b/pkgs/by-name/an/antora/test/default.nix @@ -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"; } From 4ce54003350ccc95f6ca2a0c3d4bede4a0db1f8b Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:08:55 +0200 Subject: [PATCH 10/10] antora: add naho as maintainer To simplify maintenance of the antora-ui-default and antora-lunr-extension packages, naho should also be added as a maintainer for the core Antora package. Link: https://github.com/NixOS/nixpkgs/pull/332341 --- pkgs/by-name/an/antora/package.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/an/antora/package.nix b/pkgs/by-name/an/antora/package.nix index 74a9ca183be6..87653e0cf330 100644 --- a/pkgs/by-name/an/antora/package.nix +++ b/pkgs/by-name/an/antora/package.nix @@ -40,7 +40,12 @@ buildNpmPackage rec { homepage = "https://antora.org"; license = licenses.mpl20; mainProgram = "antora"; - maintainers = [ maintainers.ehllie ]; + + maintainers = with maintainers; [ + ehllie + naho + ]; + platforms = lib.platforms.all; }; }