lol

nixos/doc: Wire up the test options reference

+45 -5
+28
nixos/doc/manual/default.nix
··· 38 38 }; 39 39 }; 40 40 41 + nixos-lib = import ../../lib { }; 42 + 43 + testOptionsDoc = let 44 + eval = nixos-lib.evalTest { 45 + # Avoid evaluating a NixOS config prototype. 46 + config.node.type = lib.types.deferredModule; 47 + options._module.args = lib.mkOption { internal = true; }; 48 + }; 49 + in buildPackages.nixosOptionsDoc { 50 + inherit (eval) options; 51 + inherit (revision); 52 + transformOptions = opt: opt // { 53 + # Clean up declaration sites to not refer to the NixOS source tree. 54 + declarations = 55 + map 56 + (decl: 57 + if hasPrefix (toString ../../..) (toString decl) 58 + then 59 + let subpath = removePrefix "/" (removePrefix (toString ../../..) (toString decl)); 60 + in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; } 61 + else decl) 62 + opt.declarations; 63 + }; 64 + documentType = "none"; 65 + variablelistId = "test-options-list"; 66 + }; 67 + 41 68 sources = lib.sourceFilesBySuffices ./. [".xml"]; 42 69 43 70 modulesDoc = builtins.toFile "modules.xml" '' ··· 52 79 mkdir $out 53 80 ln -s ${modulesDoc} $out/modules.xml 54 81 ln -s ${optionsDoc.optionsDocBook} $out/options-db.xml 82 + ln -s ${testOptionsDoc.optionsDocBook} $out/test-options-db.xml 55 83 printf "%s" "${version}" > $out/version 56 84 ''; 57 85
+8 -1
nixos/doc/manual/development/writing-nixos-tests.section.md
··· 52 52 ``` 53 53 54 54 Overrides can be added by defining an anonymous module in `all-tests.nix`. 55 - For the purpose of constructing a test matrix, use the `matrix` options instead. 56 55 57 56 ```nix 58 57 hostname = runTest { imports = [ ./hostname.nix ]; defaults.networking.firewall.enable = false; }; ··· 476 475 ``` 477 476 478 477 In that case, `numpy` is chosen from the generic `python3Packages`. 478 + 479 + ## Test Options Reference {#sec-test-options-reference} 480 + 481 + The following options can be used when writing tests. 482 + 483 + ```{=docbook} 484 + <xi:include href="../../generated/test-options-db.xml" xpointer="test-options-list"/> 485 + ```
+9 -4
nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml
··· 1 - <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-writing-nixos-tests"> 1 + <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="sec-writing-nixos-tests"> 2 2 <title>Writing Tests</title> 3 3 <para> 4 4 A NixOS test is a module that has the following structure: ··· 67 67 </programlisting> 68 68 <para> 69 69 Overrides can be added by defining an anonymous module in 70 - <literal>all-tests.nix</literal>. For the purpose of 71 - constructing a test matrix, use the <literal>matrix</literal> 72 - options instead. 70 + <literal>all-tests.nix</literal>. 73 71 </para> 74 72 <programlisting language="bash"> 75 73 hostname = runTest { imports = [ ./hostname.nix ]; defaults.networking.firewall.enable = false; }; ··· 769 767 In that case, <literal>numpy</literal> is chosen from the generic 770 768 <literal>python3Packages</literal>. 771 769 </para> 770 + </section> 771 + <section xml:id="sec-test-options-reference"> 772 + <title>Test Options Reference</title> 773 + <para> 774 + The following options can be used when writing tests. 775 + </para> 776 + <xi:include href="../../generated/test-options-db.xml" xpointer="test-options-list"/> 772 777 </section> 773 778 </section>