Skip to content

Commit 9be08a9

Browse files
committed
add check references
1 parent 8b88500 commit 9be08a9

10 files changed

Lines changed: 479 additions & 3 deletions

File tree

flake.nix

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@
4848

4949
templates = {
5050
default = {
51-
path = ./template;
51+
path = ./template/default;
5252
description = ''
5353
A minimal flake using mkdocs-flake.
5454
'';
5555
};
56+
references = {
57+
path = ./template/references;
58+
description = ''
59+
TODO
60+
'';
61+
};
5662
};
5763
};
5864

@@ -220,6 +226,39 @@
220226
checks = config.packages // {
221227
devShell = config.packages.default;
222228
formatting = treefmtEval.config.build.check inputs.self;
229+
references =
230+
let
231+
inherit ((builtins.getFlake "path:${toString ./.}?dir=template/references").packages.x86_64-linux)
232+
documentation
233+
;
234+
in
235+
pkgs.runCommand "references" { } ''
236+
cd ${documentation}
237+
238+
expectedOutput='NixOS module: foo
239+
I am a NixOS module.
240+
Feature 1
241+
I am feature 1 of NixOS module foo.
242+
(lib.mkIf (config ? "something") {
243+
foo = "bar";
244+
})
245+
246+
Feature 2
247+
I am feature 2 of NixOS module foo.
248+
{
249+
baz = "bang";
250+
quux = lib.mkDefault null; # this should not render
251+
}'
252+
output=$(
253+
<${documentation}/references/modules-nixos/foo/index.html \
254+
${lib.getExe pkgs.htmlq} --text --ignore-whitespace 'div[role=main]'
255+
)
256+
${lib.getExe' pkgs.diffutils "diff"} --unified \
257+
<(echo "$expectedOutput") \
258+
<(echo "$output")
259+
260+
touch $out
261+
'';
223262
};
224263
};
225264
}

mkdocs/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies = [
2828
"mkdocs-swagger-ui-tag>=0.6.11",
2929
"pillow>=11.1.0",
3030
"plantuml-markdown>=3.11.1",
31+
"properdocs-theme-mkdocs>=1.6.7",
3132
]
3233

3334
[tool.uv]

mkdocs/uv.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/documentation.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let
1414
strict = lib.optionalString cfg.strict "--strict";
1515

1616
yaml = pkgs.formats.yaml { };
17-
abs_docs_dir = cfg.mkdocs-root;
17+
abs_docs_dir = "${flakeSelf.outPath}/${rel_docs_dir}";
1818
rel_docs_dir = lib.path.removePrefix (
1919
/. + (builtins.unsafeDiscardStringContext flakeSelf.outPath)
2020
) cfg.mkdocs-root;
@@ -91,7 +91,7 @@ in
9191
# the hook allows the user to prepopulate font files to help avoid mkdocs
9292
# connecting to the internet.
9393
packages.documentation = pkgs.runCommand "mkdocs-flake-documentation" { } ''
94-
cd ${cfg.mkdocs-root}
94+
cd ${abs_docs_dir}
9595
mkdocs_args=(
9696
--site-dir $out
9797
${strict}
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# references
2+
3+
[./modules-nixos/foo](./modules-nixos/foo)

0 commit comments

Comments
 (0)