From f317e83a27e7e6baad3f7d766318e6b6fc2e2565 Mon Sep 17 00:00:00 2001
From: rycee checkLinkTargets
script block checks for
collisions between non-managed files and files defined in
-home.file
.
A script block should respect the DRY_RUN
-variable, if it is set then the actions taken by the script
-should be logged to standard out and not actually performed.
-The variable DRY_RUN_CMD
is set to
-echo if dry run is enabled.
A script block should also respect the
-VERBOSE
variable, and if set print
-information on standard out that may be useful for debugging
-any issue that may arise. The variable
-VERBOSE_ARG
is set to
---verbose
if verbose output is enabled.
home.file
.A script block should respect the DRY_RUN
variable. If it is set
+then the actions taken by the script should be logged to standard out
+and not actually performed. A convenient shell function run
+is provided for activation script blocks. It is used as follows:
Runs the given command on live run, otherwise prints the command to +standard output.
Runs the given command on live run and sends its standard and error
+output to /dev/null
, otherwise prints the command to standard
+output.
A script block should also respect the VERBOSE
variable, and if
+set print information on standard out that may be useful for debugging
+any issue that may arise. The variable VERBOSE_ARG
is set to
+--verbose
if verbose output is enabled. You can also use the
+provided shell function verboseEcho, which acts as
+echo when verbose output is enabled.
Type: DAG of string
@@ -7060,7 +7062,7 @@ DAG of stringExample:
{
myActivationAction = lib.hm.dag.entryAfter ["writeBoundary"] ''
- $DRY_RUN_CMD ln -s $VERBOSE_ARG \
+ run ln -s $VERBOSE_ARG \
${builtins.toPath ./link-me-directly} $HOME
'';
}
diff --git a/release-notes.xhtml b/release-notes.xhtml
index b98e2b2bb..a0ea91bd2 100644
--- a/release-notes.xhtml
+++ b/release-notes.xhtml
@@ -37,7 +37,35 @@ will override any other configuration and cause, for example, the
removal of all managed files.Please be very careful when enabling this option since activating
the built configuration will not only remove the managed files but
all Home Manager state from your user environment. This includes
-removing all your historic Home Manager generations!
+removing all your historic Home Manager generations!The use of $DRY_RUN_CMD
and $DRY_RUN_NULL
in activation script
+blocks is now deprecated. Instead use the new shell function
+run. In most cases it is sufficient to replace
+$DRY_RUN_CMD
by run. For example, if your configuration
+currently contains
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
+ if [[ -v oldGenPath ]]; then
+ $DRY_RUN_CMD nix store diff-closures $oldGenPath $newGenPath
+ fi
+'';
+
then you are now encouraged to change to
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
+ if [[ -v oldGenPath ]]; then
+ run nix store diff-closures $oldGenPath $newGenPath
+ fi
+'';
+
See the description of home.activation 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.
Similarly, the use of $VERBOSE_ECHO
in activation script blocks is
+deprecated. Instead use the new shell function
+verboseEcho. That is,
home.activation.doThing = config.lib.dag.entryAnywhere ''
+ $VERBOSE_ECHO "Doing the thing"
+''
+
should now be expressed
home.activation.doThing = config.lib.dag.entryAnywhere ''
+ verboseEcho "Doing the thing"
+''
+
See the description of home.activation 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.