diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 836e0b25..c9515d4f 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -235,17 +235,51 @@ in }; home.activation = mkOption { - internal = true; type = dagOf types.str; default = {}; + example = literalExample '' + { + myActivationAction = config.lib.dag.entryAfter ["writeBoundary"] ''' + $DRY_RUN_CMD ln -s $VERBOSE_ARG \ + ''${builtins.toPath ./link-me-directly} $HOME + '''; + } + ''; description = '' - Activation scripts for the home environment. + The activation scripts blocks to run when activating a Home + Manager generation. Any entry here should be idempotent, + meaning running twice or more times produces the same result + as running it once. + - Any script should respect the DRY_RUN - variable, if it is set then no actual action should be taken. + + If the script block produces any observable side effect, such + as writing or deleting files, then it + must be placed after the special + writeBoundary script block. Prior to the + write boundary one can place script blocks that verifies, but + does not modify, the state of the system and exits if an + unexpected state is found. For example, the + 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. Thus, many cases you - can use the idiom $DRY_RUN_CMD rm -rf /. + 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 + if verbose output is enabled. ''; };