-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
antora-lunr-extension: init at 1.0.0-alpha.8 #332341
antora-lunr-extension: init at 1.0.0-alpha.8 #332341
Conversation
0fabb09
to
827c50d
Compare
827c50d
to
465f7f2
Compare
Changelogv2: 465f7f2
v1: 827c50d
v0: 0fabb09 |
The "Vet nixpkgs" action fails with the following error message:
@philiptaron, how to pass files as an explicit argument when packages are not explicitly defined in The For reference, commit b807da48ae86f49ece76ec9d77cb288dc8f50e47 ("antora: move package into pkgs/by-name directory") explicitly removes the package declaration from |
Thanks for the question, Noah (@trueNAHO). In this case, you want to have
Instead of taking a dependency in your derivation on a path, take a dependency on the package. I think it's also fine to do some copying -- in other words, have one test for antora, and another for the lunr extension. They'll happen to share a lot of stuff, but that's OK. |
465f7f2
to
b63ef6d
Compare
Changelogv3: b63ef6d
v2: 465f7f2
v1: 827c50d
v0: 0fabb09 |
I rebased your elegant proposal into commit 42a162d ("antora-lunr-extension: init at 1.0.0-alpha.8"): From 17c1ec3fff056b4d50c0d5ef2fd9121a5a94e976 Mon Sep 17 00:00:00 2001
From: NAHO <[email protected]>
Date: Sun, 29 Sep 2024 12:05:23 +0200
Subject: [PATCH] antora-lunr-extension: do not access files outside package
---
pkgs/by-name/an/antora-lunr-extension/package.nix | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pkgs/by-name/an/antora-lunr-extension/package.nix b/pkgs/by-name/an/antora-lunr-extension/package.nix
index 222580dec7a7..4a3c78554db6 100644
--- a/pkgs/by-name/an/antora-lunr-extension/package.nix
+++ b/pkgs/by-name/an/antora-lunr-extension/package.nix
@@ -1,6 +1,6 @@
{
+ antora,
buildNpmPackage,
- callPackage,
fetchFromGitLab,
lib,
nix-update-script,
@@ -23,7 +23,7 @@ buildNpmPackage rec {
npmDepsHash = "sha256-EtjZL6U/uSGSYSqtuatCkdWP0NHxRuht13D9OaM4x00=";
passthru = {
- tests.run = callPackage ../antora/test {
+ tests.run = antora.tests.run.override {
antora-lunr-extension-test = true;
};
-- I might have figured this out myself if the error message did not get me stuck on |
I'm planning on doing a pass through all the errors that can come from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does @ehllie think of this?
srcFetchFromGitLab = { | ||
hash = "sha256-q2FwkwzjanxTIxjMpCyMpzPt782uYZiWVdZ7Eev79oM="; | ||
owner = "trueNAHO"; | ||
repo = "antora-ui-default"; | ||
rev = "83bf9bf5f22a6dee397f8b089eb0315c14a278b5"; | ||
}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
Should I inline all srcFetchFromGitLab
instances or only pname
?
From my point of view as long as the antora package builds it's as good as it was. It was an auto-generated with node2nix before, and I repackaged it as an example of how other packages in node-packages.json could be moved for the purpose of this issue #229475. |
Move the antora package from the deprecated location into the pkgs/by-name directory to regroup future Antora packages. Link: NixOS#332341
Let's take a look at what the script is doing for us.
We don't need any of that; the repository is empty.So we can resolve it by deleting the line and blaming me for picking an example that wasn't what was needed in this case. |
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: NixOS#332341
57d984c
to
7a31aa5
Compare
Changelogv6: 7a31aa5
v5: 57d984c
v4: a8b38f5
v3: b63ef6d
v2: 465f7f2
v1: 827c50d
v0: 0fabb09 |
In that case, should the $ git checkout --quiet 8885a1e21ad43f8031c738a08029cd1d4dcbc2f7 && rg deterministic-git
pkgs/development/compilers/flutter/flutter.nix: (. '${../../../build-support/fetchgit/deterministic-git}'; make_deterministic_repo .)
pkgs/development/compilers/flutter/engine/source.nix: source ${../../../../build-support/fetchgit/deterministic-git} If yes, I can submit a PR for this. Here is the PR introducing |
Friendly ping: AFAIK, this PR is merge-ready. |
|
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: NixOS#332341
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: NixOS#332341
7a31aa5
to
a883a99
Compare
Changelogv7: a883a99
v6: 7a31aa5
v5: 57d984c
v4: a8b38f5
v3: b63ef6d
v2: 465f7f2
v1: 827c50d
v0: 0fabb09 |
v7 works around the issue by installing the UI bundle in the diff --git a/pkgs/by-name/an/antora-ui-default/package.nix b/pkgs/by-name/an/antora-ui-default/package.nix
index b0ae50e094dc..2e1278026ae8 100644
--- a/pkgs/by-name/an/antora-ui-default/package.nix
+++ b/pkgs/by-name/an/antora-ui-default/package.nix
@@ -41,7 +41,14 @@ stdenvNoCC.mkDerivation {
src = fetchFromGitLab srcFetchFromGitLab;
phases = [ "installPhase" ];
- installPhase = ''install --mode 755 -D "$src/ui-bundle.zip" "$out"'';
+
+ # 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 = ''
+ install --mode 755 -D "$src/ui-bundle.zip" "$out/ui-bundle.zip"
+ '';
meta = {
description = "Antora default UI bundle";
@@ -56,8 +63,9 @@ stdenvNoCC.mkDerivation {
> -- Antora
> https://docs.antora.org/antora/3.1/playbook/ui-bundle-url
- This UI bundle is intended to be passed to `antora`'s `--ui-bundle-url`
- flag or injected into the [`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)
diff --git a/pkgs/by-name/an/antora/test/default.nix b/pkgs/by-name/an/antora/test/default.nix
index 08cba1660aa8..ce5e0d5f50bb 100644
--- a/pkgs/by-name/an/antora/test/default.nix
+++ b/pkgs/by-name/an/antora/test/default.nix
@@ -47,7 +47,7 @@ stdenvNoCC.mkDerivation {
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-url = "${antora-ui-default}/ui-bundle.zip";
}
} "${playbook}"
''; It seem more reasonable to comply with the |
|
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: NixOS#332341
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: NixOS#332341
a883a99
to
faf1557
Compare
Changelogv8: 4ce5400
v7: a883a99
v6: 7a31aa5
v5: 57d984c
v4: a8b38f5
v3: b63ef6d
v2: 465f7f2
v1: 827c50d
v0: 0fabb09 |
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: NixOS#332341
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: NixOS#332341
faf1557
to
4ce5400
Compare
|
Description of changes
This patchset introduces the Antora Lunr extension, complementing the
pkgs.antora
package:This extension is officially supported by Antora and heavily maintained by the AsciiDoc team.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.