1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 11:36:03 +01:00

Run linkcheck as regular passthru test

... and add nix-manual.site attribute for a nice and DRY aftertaste.
This commit is contained in:
Robert Hensing 2025-11-04 01:10:02 +01:00
parent e07510e504
commit 9f322398b4
2 changed files with 33 additions and 23 deletions

View file

@ -18,6 +18,9 @@
# Configuration Options # Configuration Options
version, version,
# `tests` attribute
testers,
}: }:
let let
@ -87,6 +90,29 @@ mkMesonDerivation (finalAttrs: {
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
''; '';
/**
The root of the HTML manual.
E.g. "${nix-manual.site}/index.html" exists.
*/
passthru.site = finalAttrs.finalPackage + "/share/doc/nix/manual";
passthru.tests = {
# https://nixos.org/manual/nixpkgs/stable/index.html#tester-lycheeLinkCheck
linkcheck = testers.lycheeLinkCheck {
inherit (finalAttrs.finalPackage) site;
extraConfig = {
exclude = [
# Exclude auto-generated JSON schema documentation which has
# auto-generated fragment IDs that don't match the link references
".*/protocols/json/.*\\.html"
# Exclude undocumented builtins
".*/language/builtins\\.html#builtins-addErrorContext"
".*/language/builtins\\.html#builtins-appendContext"
];
};
};
};
meta = { meta = {
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };

View file

@ -320,30 +320,14 @@
checks = forAllSystems ( checks = forAllSystems (
system: system:
let (import ./ci/gha/tests {
pkgs = nixpkgsFor.${system}.native;
in
{
# https://nixos.org/manual/nixpkgs/stable/index.html#tester-lycheeLinkCheck
linkcheck = pkgs.testers.lycheeLinkCheck {
site = self.packages.${system}.nix-manual + "/share/doc/nix/manual";
extraConfig = {
exclude = [
# Exclude auto-generated JSON schema documentation which has
# auto-generated fragment IDs that don't match the link references
".*/protocols/json/.*\\.html"
# Exclude undocumented builtins
".*/language/builtins\\.html#builtins-addErrorContext"
".*/language/builtins\\.html#builtins-appendContext"
];
};
};
}
// (import ./ci/gha/tests {
inherit system; inherit system;
pkgs = nixpkgsFor.${system}.native; pkgs = nixpkgsFor.${system}.native;
nixFlake = self; nixFlake = self;
}).topLevel }).topLevel
// {
inherit (self.packages.${system}.nix-manual.tests) linkcheck;
}
// (lib.optionalAttrs (builtins.elem system linux64BitSystems)) { // (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
dockerImage = self.hydraJobs.dockerImage.${system}; dockerImage = self.hydraJobs.dockerImage.${system};
} }
@ -504,10 +488,10 @@
open-manual = { open-manual = {
type = "app"; type = "app";
program = "${pkgs.writeShellScript "open-nix-manual" '' program = "${pkgs.writeShellScript "open-nix-manual" ''
manual_path="${self.packages.${system}.nix-manual}/share/doc/nix/manual/index.html" path="${self.packages.${system}.nix-manual.site}/index.html"
if ! ${opener} "$manual_path"; then if ! ${opener} "$path"; then
echo "Failed to open manual with ${opener}. Manual is located at:" echo "Failed to open manual with ${opener}. Manual is located at:"
echo "$manual_path" echo "$path"
fi fi
''}"; ''}";
meta.description = "Open the Nix manual in your browser"; meta.description = "Open the Nix manual in your browser";