flake: Use lychee for link checking

Introduce [lychee] link checking in the flake.nix checks.
Since `nix flake check` is limited by sandboxing, it only checks for
internal links.

Running `lychee` from the directory will check external links.
In the future, this can be done via git hooks.

[lychee]: https://github.com/lycheeverse/lychee
This commit is contained in:
Fintan Halpenny
2026-07-24 18:48:14 +02:00
committed by Lorenz Leutgeb
parent e837178f5e
commit 99a2a29f0a
3 changed files with 44 additions and 14 deletions
+2
View File
@@ -1,2 +1,4 @@
node_modules/ node_modules/
result result
.lycheecache
.direnv/
+30 -14
View File
@@ -26,6 +26,7 @@
buildInputs = buildInputs =
(with pkgs; [ (with pkgs; [
asciidoctor asciidoctor
pkgs.lychee
nodejs nodejs
shellcheck shellcheck
yq yq
@@ -35,20 +36,35 @@
]; ];
}; };
checks.grammar = checks = {
pkgs.runCommand "grammar-check" { grammar =
nativeBuildInputs = pkgs.runCommand "grammar-check" {
(with pkgs; [ nativeBuildInputs =
nearley (with pkgs; [
nodejs nearley
yq nodejs
]) yq
++ [ ])
nearley ++ [
nearley
];
} ''
${./0004-general-uri-scheme/data/test/uri-scheme-tester.sh} ${./0004-general-uri-scheme/data}
touch $out
'';
links = pkgs.testers.lycheeLinkCheck {
site = pkgs.lib.sources.sourceFilesBySuffices ./. [".md" ".adoc"];
extraConfig = {
extensions = ["md" "adoc"];
include_fragments = true;
exclude = [
"^rad:.*$"
"^web\\+rad:.*$"
"^vscode:.*$"
]; ];
} '' };
${./0004-general-uri-scheme/data/test/uri-scheme-tester.sh} ${./0004-general-uri-scheme/data} };
touch $out };
'';
}); });
} }
+12
View File
@@ -0,0 +1,12 @@
extensions = ["md", "adoc"]
include_fragments = true
# Exclude custom URI schemes that lychee cannot resolve
exclude = [
'^rad:',
'^web\+rad:',
'^vscode:',
]
include_mail = false
timeout = 20
max_retries = 2
retry_wait_time = 2