1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 19:49:45 +01:00
This commit is contained in:
rycee 2024-01-24 19:51:22 +00:00
parent 13632c0620
commit f317e83a27
2 changed files with 42 additions and 12 deletions

View file

@ -7041,16 +7041,18 @@ does not modify, the state of the system and exits if an
unexpected state is found. For example, the unexpected state is found. For example, the
<code class="literal">checkLinkTargets</code> script block checks for <code class="literal">checkLinkTargets</code> script block checks for
collisions between non-managed files and files defined in collisions between non-managed files and files defined in
<a class="xref" href="options.xhtml#opt-home.file" ><code class="option">home.file</code></a>.</p><p>A script block should respect the <code class="varname">DRY_RUN</code> <a class="xref" href="options.xhtml#opt-home.file" ><code class="option">home.file</code></a>.</p><p>A script block should respect the <code class="varname">DRY_RUN</code> variable. If it is set
variable, if it is set then the actions taken by the script then the actions taken by the script should be logged to standard out
should be logged to standard out and not actually performed. and not actually performed. A convenient shell function <span class="command"><strong>run</strong></span>
The variable <code class="varname">DRY_RUN_CMD</code> is set to is provided for activation script blocks. It is used as follows:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="command"><strong>run {command}</strong></span></span></dt><dd><p>Runs the given command on live run, otherwise prints the command to
<span class="command"><strong>echo</strong></span> if dry run is enabled.</p><p>A script block should also respect the standard output.</p></dd><dt><span class="term"><span class="command"><strong>run --silence {command}</strong></span></span></dt><dd><p>Runs the given command on live run and sends its standard and error
<code class="varname">VERBOSE</code> variable, and if set print output to <code class="filename">/dev/null</code>, otherwise prints the command to standard
information on standard out that may be useful for debugging output.</p></dd></dl></div><p>A script block should also respect the <code class="varname">VERBOSE</code> variable, and if
any issue that may arise. The variable set print information on standard out that may be useful for debugging
<code class="varname">VERBOSE_ARG</code> is set to any issue that may arise. The variable <code class="varname">VERBOSE_ARG</code> is set to
<code class="option">--verbose</code> if verbose output is enabled.</p> <code class="option">--verbose</code> if verbose output is enabled. You can also use the
provided shell function <span class="command"><strong>verboseEcho</strong></span>, which acts as
<span class="command"><strong>echo</strong></span> when verbose output is enabled.</p>
<p><span class="emphasis"><em>Type:</em></span> <p><span class="emphasis"><em>Type:</em></span>
DAG of string</p> DAG of string</p>
@ -7060,7 +7062,7 @@ DAG of string</p>
<p><span class="emphasis"><em>Example:</em></span></p><pre><code class="programlisting">{ <p><span class="emphasis"><em>Example:</em></span></p><pre><code class="programlisting">{
myActivationAction = lib.hm.dag.entryAfter [&quot;writeBoundary&quot;] &#x27;&#x27; myActivationAction = lib.hm.dag.entryAfter [&quot;writeBoundary&quot;] &#x27;&#x27;
$DRY_RUN_CMD ln -s $VERBOSE_ARG \ run ln -s $VERBOSE_ARG \
${builtins.toPath ./link-me-directly} $HOME ${builtins.toPath ./link-me-directly} $HOME
&#x27;&#x27;; &#x27;&#x27;;
} }

View file

@ -37,7 +37,35 @@ will override any other configuration and cause, for example, the
removal of all managed files.</p><p>Please be very careful when enabling this option since activating removal of all managed files.</p><p>Please be very careful when enabling this option since activating
the built configuration will not only remove the managed files but the built configuration will not only remove the managed files but
<span class="emphasis"><em>all</em></span> Home Manager state from your user environment. This includes <span class="emphasis"><em>all</em></span> Home Manager state from your user environment. This includes
removing all your historic Home Manager generations!</p></li></ul></div> removing all your historic Home Manager generations!</p></li><li class="listitem"><p>The use of <code class="literal">$DRY_RUN_CMD</code> and <code class="literal">$DRY_RUN_NULL</code> in activation script
blocks is now deprecated. Instead use the new shell function
<span class="command"><strong>run</strong></span>. In most cases it is sufficient to replace
<code class="literal">$DRY_RUN_CMD</code> by <span class="command"><strong>run</strong></span>. For example, if your configuration
currently contains</p><pre><code class="programlisting nix">home.activation.reportChanges = config.lib.dag.entryAnywhere &#x27;&#x27;
if [[ -v oldGenPath ]]; then
$DRY_RUN_CMD nix store diff-closures $oldGenPath $newGenPath
fi
&#x27;&#x27;;
</code></pre><p>then you are now encouraged to change to</p><pre><code class="programlisting nix">home.activation.reportChanges = config.lib.dag.entryAnywhere &#x27;&#x27;
if [[ -v oldGenPath ]]; then
run nix store diff-closures $oldGenPath $newGenPath
fi
&#x27;&#x27;;
</code></pre><p>See the description of <a class="link" href="options.xhtml#opt-home.activation" >home.activation</a> for
more. The deprecated variables will continue to work for now but
their use may in the future trigger a warning message and eventually
they may be removed entirely.</p></li><li class="listitem"><p>Similarly, the use of <code class="literal">$VERBOSE_ECHO</code> in activation script blocks is
deprecated. Instead use the new shell function
<span class="command"><strong>verboseEcho</strong></span>. That is,</p><pre><code class="programlisting nix">home.activation.doThing = config.lib.dag.entryAnywhere &#x27;&#x27;
$VERBOSE_ECHO &quot;Doing the thing&quot;
&#x27;&#x27;
</code></pre><p>should now be expressed</p><pre><code class="programlisting nix">home.activation.doThing = config.lib.dag.entryAnywhere &#x27;&#x27;
verboseEcho &quot;Doing the thing&quot;
&#x27;&#x27;
</code></pre><p>See the description of <a class="link" href="options.xhtml#opt-home.activation" >home.activation</a> for
more. The deprecated variable will continue to work for now but its
use may in the future trigger a warning message and eventually it
may be removed entirely.</p></li></ul></div>
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"> <a id="sec-release-24.05-state-version-changes"></a>State Version Changes </h2> </div> </div></div><p>The state version in this release includes the changes below. These </div><div class="section"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"> <a id="sec-release-24.05-state-version-changes"></a>State Version Changes </h2> </div> </div></div><p>The state version in this release includes the changes below. These
changes are only active if the <code class="literal">home.stateVersion</code> option is set to changes are only active if the <code class="literal">home.stateVersion</code> option is set to
&quot;24.05&quot; or later.</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc;"><li class="listitem"><p>Nothing, yet.</p></li></ul></div> &quot;24.05&quot; or later.</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc;"><li class="listitem"><p>Nothing, yet.</p></li></ul></div>