Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

60 lines
1.3 KiB
Nix

# Run tests: nix-build -A tests.nixosOptionsDoc
{
lib,
nixosOptionsDoc,
runCommand,
}:
let
inherit (lib) mkOption types;
eval = lib.evalModules {
modules = [
{
options.foo.bar.enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable the foo bar feature.
'';
};
}
];
};
doc = nixosOptionsDoc {
inherit (eval) options;
};
in
{
/**
Test that
- the `nixosOptionsDoc` function can be invoked
- integration of the module system and `nixosOptionsDoc` (limited coverage)
The more interesting tests happen in the `nixos-render-docs` package.
*/
commonMark =
runCommand "test-nixosOptionsDoc-commonMark"
{
commonMarkDefault = doc.optionsCommonMark;
commonMarkAnchors = doc.optionsCommonMark.overrideAttrs {
extraArgs = [
"--anchor-prefix"
"my-opt-"
"--anchor-style"
"legacy"
];
};
}
''
env | grep ^commonMark | sed -e 's/=/ = /'
(
set -x
grep -F 'foo\.bar\.enable' $commonMarkDefault >/dev/null
grep -F '{#my-opt-foo.bar.enable}' $commonMarkAnchors >/dev/null
)
touch $out
'';
}