1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 15:09:46 +01:00
This commit is contained in:
ncfavier 2023-05-17 11:00:32 +00:00
parent 2f4233bf54
commit d78efbd86b

View file

@ -594,7 +594,7 @@ If you refer to an option then write its full attribute path. That is, instead o
</p><pre class="screen">The option 'foo' has been deprecated, please use 'bar' instead.</pre><p class="simpara">it should read</p><pre class="screen">The option 'services.myservice.foo' has been deprecated, please
use 'services.myservice.bar' instead.</pre></li><li class="listitem"><p class="simpara">
A new module, say <code class="literal">foo.nix</code>, should always include a news entry that has a message along the lines of
</p><pre class="screen">A new module is available: 'services.foo'.</pre><p class="simpara">If the module is platform specific, e.g., a service module using systemd, then a condition like</p><pre class="programlisting nix">condition = hostPlatform.isLinux;</pre><p class="simpara">should be added. If you contribute a module then you dont need to add this entry, the merger will create an entry for you.</p></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sec-tests"></a>5.6. Tests</h2></div></div></div><p>Home Manager includes a basic test suite and it is highly recommended to include at least one test when adding a module. Tests are typically in the form of "golden tests" where, for example, a generated configuration file is compared to a known correct file.</p><p>It is relatively easy to create tests by modeling the existing tests, found in the <code class="literal">tests</code> project directory.</p><p>The full Home Manager test suite can be run by executing</p><pre class="programlisting console">$ nix-shell --pure tests -A run.all</pre><p>in the project root. List all test cases through</p><pre class="programlisting console">$ nix-shell --pure tests -A list</pre><p>and run an individual test, for example <code class="literal">alacritty-empty-settings</code>, through</p><pre class="programlisting console">$ nix-shell --pure tests -A run.alacritty-empty-settings</pre><p>However, those invocations will impurely source the systems nixpkgs, and may cause failures. To run against the nixpkgs from the flake.lock, use instead e.g.</p><pre class="programlisting console">$ nix develop --ignore-environment .#tests.all</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="ch-3rd-party"></a>Chapter 6. Third-Party Tools and Extensions</h1></div></div></div><p>Here is a collection of tools and extensions that relate to Home
</p><pre class="screen">A new module is available: 'services.foo'.</pre><p class="simpara">If the module is platform specific, e.g., a service module using systemd, then a condition like</p><pre class="programlisting nix">condition = hostPlatform.isLinux;</pre><p class="simpara">should be added. If you contribute a module then you dont need to add this entry, the merger will create an entry for you.</p></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sec-tests"></a>5.6. Tests</h2></div></div></div><p>Home Manager includes a basic test suite and it is highly recommended to include at least one test when adding a module. Tests are typically in the form of "golden tests" where, for example, a generated configuration file is compared to a known correct file.</p><p>It is relatively easy to create tests by modeling the existing tests, found in the <code class="literal">tests</code> project directory.</p><p>The full Home Manager test suite can be run by executing</p><pre class="programlisting console">$ nix-shell --pure tests -A run.all</pre><p>in the project root. List all test cases through</p><pre class="programlisting console">$ nix-shell --pure tests -A list</pre><p>and run an individual test, for example <code class="literal">alacritty-empty-settings</code>, through</p><pre class="programlisting console">$ nix-shell --pure tests -A run.alacritty-empty-settings</pre><p>However, those invocations will impurely source the systems nixpkgs, and may cause failures. To run against the nixpkgs from the flake.lock, use instead e.g.</p><pre class="programlisting console">$ nix develop --ignore-environment .#all</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="ch-3rd-party"></a>Chapter 6. Third-Party Tools and Extensions</h1></div></div></div><p>Here is a collection of tools and extensions that relate to Home
Manager. Note, these are maintained outside the regular Home Manager
flow so quality and support may vary wildly. If you encounter problems
then please raise them in the corresponding project, not as issues in