forked from mirrors/nixpkgs
nixos/documentation: Add unit test
This commit is contained in:
parent
ec3e1c6a3a
commit
9aa588ecc3
49
nixos/modules/misc/documentation/test.nix
Normal file
49
nixos/modules/misc/documentation/test.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ nixosLib, pkgsModule, runCommand }:
|
||||
|
||||
let
|
||||
sys = nixosLib.evalModules rec {
|
||||
modules = [
|
||||
pkgsModule
|
||||
../documentation.nix
|
||||
../version.nix
|
||||
|
||||
({ lib, someArg, ... }: {
|
||||
# Make sure imports from specialArgs are respected
|
||||
imports = [ someArg.myModule ];
|
||||
|
||||
# TODO test this
|
||||
meta.doc = ./test-dummy.chapter.xml;
|
||||
})
|
||||
|
||||
{
|
||||
_module.args = {
|
||||
baseModules = [
|
||||
../documentation.nix
|
||||
../version.nix
|
||||
];
|
||||
extraModules = [ ];
|
||||
inherit modules;
|
||||
};
|
||||
documentation.nixos.includeAllModules = true;
|
||||
}
|
||||
];
|
||||
specialArgs.someArg.myModule = { lib, ... }: {
|
||||
options.foobar = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The foobar option was added via specialArgs";
|
||||
default = "qux";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
runCommand "documentation-check"
|
||||
{
|
||||
inherit (sys.config.system.build.manual) optionsJSON;
|
||||
} ''
|
||||
json="$optionsJSON/share/doc/nixos/options.json"
|
||||
echo checking $json
|
||||
|
||||
grep 'The foobar option was added via specialArgs' <"$json" >/dev/null
|
||||
touch $out
|
||||
''
|
|
@ -127,6 +127,7 @@ in {
|
|||
docker-tools-cross = handleTestOn ["x86_64-linux" "aarch64-linux"] ./docker-tools-cross.nix {};
|
||||
docker-tools-overlay = handleTestOn ["x86_64-linux"] ./docker-tools-overlay.nix {};
|
||||
documize = handleTest ./documize.nix {};
|
||||
documentation = pkgs.callPackage ../modules/misc/documentation/test.nix { inherit nixosLib; };
|
||||
doh-proxy-rust = handleTest ./doh-proxy-rust.nix {};
|
||||
dokuwiki = handleTest ./dokuwiki.nix {};
|
||||
domination = handleTest ./domination.nix {};
|
||||
|
|
Loading…
Reference in a new issue