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:
parent
e07510e504
commit
9f322398b4
2 changed files with 33 additions and 23 deletions
|
|
@ -18,6 +18,9 @@
|
|||
# Configuration Options
|
||||
|
||||
version,
|
||||
|
||||
# `tests` attribute
|
||||
testers,
|
||||
}:
|
||||
|
||||
let
|
||||
|
|
@ -87,6 +90,29 @@ mkMesonDerivation (finalAttrs: {
|
|||
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 = {
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
|
|
|
|||
30
flake.nix
30
flake.nix
|
|
@ -320,30 +320,14 @@
|
|||
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
let
|
||||
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 {
|
||||
(import ./ci/gha/tests {
|
||||
inherit system;
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
nixFlake = self;
|
||||
}).topLevel
|
||||
// {
|
||||
inherit (self.packages.${system}.nix-manual.tests) linkcheck;
|
||||
}
|
||||
// (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
|
||||
dockerImage = self.hydraJobs.dockerImage.${system};
|
||||
}
|
||||
|
|
@ -504,10 +488,10 @@
|
|||
open-manual = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScript "open-nix-manual" ''
|
||||
manual_path="${self.packages.${system}.nix-manual}/share/doc/nix/manual/index.html"
|
||||
if ! ${opener} "$manual_path"; then
|
||||
path="${self.packages.${system}.nix-manual.site}/index.html"
|
||||
if ! ${opener} "$path"; then
|
||||
echo "Failed to open manual with ${opener}. Manual is located at:"
|
||||
echo "$manual_path"
|
||||
echo "$path"
|
||||
fi
|
||||
''}";
|
||||
meta.description = "Open the Nix manual in your browser";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue