lol

nixos/doc/writing-nixos-tests: Various improvements

Thanks to fricklerhandwerk for the many suggestions, most of which
I have fixupped into preceding commits.

+19 -18
+8 -7
nixos/doc/manual/development/writing-nixos-tests.section.md
··· 39 39 40 40 ## Calling a test {#sec-calling-nixos-tests} 41 41 42 - Tests are invoked a bit differently depending on whether the test lives in NixOS or in another project. 42 + Tests are invoked differently depending on whether the test is part of NixOS or lives in a different project. 43 43 44 44 ### Testing within NixOS {#sec-call-nixos-test-in-nixos} 45 - 46 - Test modules can be instantiated into derivations in multiple ways. 47 45 48 46 Tests that are part of NixOS are added to [`nixos/tests/all-tests.nix`](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/all-tests.nix). 49 47 ··· 54 52 Overrides can be added by defining an anonymous module in `all-tests.nix`. 55 53 56 54 ```nix 57 - hostname = runTest { imports = [ ./hostname.nix ]; defaults.networking.firewall.enable = false; }; 55 + hostname = runTest { 56 + imports = [ ./hostname.nix ]; 57 + defaults.networking.firewall.enable = false; 58 + }; 58 59 ``` 59 60 60 - You can run a test with attribute name `mytest` in `nixos/tests/all-tests.nix` by invoking: 61 + You can run a test with attribute name `hostname` in `nixos/tests/all-tests.nix` by invoking: 61 62 62 63 ```shell 63 64 cd /my/git/clone/of/nixpkgs 64 - nix-build -A nixosTests.mytest 65 + nix-build -A nixosTests.hostname 65 66 ``` 66 67 67 68 ### Testing outside the NixOS project {#sec-call-nixos-test-outside-nixos} 68 69 69 - Outside the `nixpkgs` repository, you can instantiate the test by first acquiring the NixOS library, 70 + Outside the `nixpkgs` repository, you can instantiate the test by first importing the NixOS library, 70 71 71 72 ```nix 72 73 # regular nix
+11 -11
nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml
··· 49 49 <section xml:id="sec-calling-nixos-tests"> 50 50 <title>Calling a test</title> 51 51 <para> 52 - Tests are invoked a bit differently depending on whether the test 53 - lives in NixOS or in another project. 52 + Tests are invoked differently depending on whether the test is 53 + part of NixOS or lives in a different project. 54 54 </para> 55 55 <section xml:id="sec-call-nixos-test-in-nixos"> 56 56 <title>Testing within NixOS</title> 57 - <para> 58 - Test modules can be instantiated into derivations in multiple 59 - ways. 60 - </para> 61 57 <para> 62 58 Tests that are part of NixOS are added to 63 59 <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/all-tests.nix"><literal>nixos/tests/all-tests.nix</literal></link>. ··· 70 66 <literal>all-tests.nix</literal>. 71 67 </para> 72 68 <programlisting language="bash"> 73 - hostname = runTest { imports = [ ./hostname.nix ]; defaults.networking.firewall.enable = false; }; 69 + hostname = runTest { 70 + imports = [ ./hostname.nix ]; 71 + defaults.networking.firewall.enable = false; 72 + }; 74 73 </programlisting> 75 74 <para> 76 - You can run a test with attribute name <literal>mytest</literal> 77 - in <literal>nixos/tests/all-tests.nix</literal> by invoking: 75 + You can run a test with attribute name 76 + <literal>hostname</literal> in 77 + <literal>nixos/tests/all-tests.nix</literal> by invoking: 78 78 </para> 79 79 <programlisting> 80 80 cd /my/git/clone/of/nixpkgs 81 - nix-build -A nixosTests.mytest 81 + nix-build -A nixosTests.hostname 82 82 </programlisting> 83 83 </section> 84 84 <section xml:id="sec-call-nixos-test-outside-nixos"> 85 85 <title>Testing outside the NixOS project</title> 86 86 <para> 87 87 Outside the <literal>nixpkgs</literal> repository, you can 88 - instantiate the test by first acquiring the NixOS library, 88 + instantiate the test by first importing the NixOS library, 89 89 </para> 90 90 <programlisting language="bash"> 91 91 # regular nix