test: add test nixosSearch

This checks that creating module docs for search.nixos.org succceeds.
Errors can happen when complex `default` values can't be evaluated
or on malformed Docbook XML in descriptions.
This commit is contained in:
Erik Arvstedt 2021-12-08 04:07:32 +01:00
parent 77d8c00c53
commit eaf98f92db
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
4 changed files with 71 additions and 0 deletions

View File

@ -26,11 +26,16 @@ if [[ ${1:-} != -f ]] && ! git diff --quiet ../flake.{nix,lock}; then
exit 1
fi
echo "Updating flake 'nixos-search'"
nix flake update ../test/nixos-search
echo
versions=$(nix eval --json -f update-flake.nix versions)
## Uncomment the following to generate a version change message for testing
# versions=$(echo "$versions" | sed 's|1|0|g')
echo "Updating main flake"
nix flake update ..
echo

View File

@ -0,0 +1,44 @@
{
"nodes": {
"nixos-search": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1638831015,
"narHash": "sha256-WmCsa6gSY01Yt0wminCbNV8Mn+4iU1OEF5r3YUh6SVs=",
"owner": "nixos",
"repo": "nixos-search",
"rev": "fa5fe2a61c36ed90506af75c19bfaf2f9d537d87",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixos-search",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1631118067,
"narHash": "sha256-tEcFvm3a6ToeBGwHdjfB2mVQwa4LZCZTQYE2LnY3ycA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "09cd65b33c5653d7d2954fef4b9f0e718c899743",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixos-search": "nixos-search"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,9 @@
# This flake just mirrors input `nixos-search`.
# Because `nixos-search` is a dev-only dependency, we don't add
# it to the main flake.
{
inputs.nixos-search.url = "github:nixos/nixos-search";
outputs = { self, nixos-search }: {
inherit (nixos-search) packages;
};
}

View File

@ -267,6 +267,18 @@ flake() {
nix flake check "$scriptDir/.."
}
# Test generating module documentation for search.nixos.org
nixosSearch() {
if ! checkFlakeSupport "nixosSearch"; then return; fi
if [[ $outLinkPrefix ]]; then
# Add gcroots for flake-info
nix build $scriptDir/nixos-search#flake-info -o "$outLinkPrefix-flake-info"
fi
echo "Running flake-info (nixos-search)"
nix run $scriptDir/nixos-search#flake-info -- flake ../.
}
# A basic subset of tests to keep the total runtime within
# manageable bounds (<4 min on desktop systems).
# These are also run on the CI server.
@ -300,6 +312,7 @@ all() {
buildable
examples
flake
nixosSearch
}
# An alias for buildTest