mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 10:49:48 +01:00
home-environment: make home.activation
public
Also improve documentation and add an example.
This commit is contained in:
parent
7f87329fca
commit
f65510b1d1
1 changed files with 40 additions and 6 deletions
|
@ -235,17 +235,51 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
home.activation = mkOption {
|
home.activation = mkOption {
|
||||||
internal = true;
|
|
||||||
type = dagOf types.str;
|
type = dagOf types.str;
|
||||||
default = {};
|
default = {};
|
||||||
|
example = literalExample ''
|
||||||
|
{
|
||||||
|
myActivationAction = config.lib.dag.entryAfter ["writeBoundary"] '''
|
||||||
|
$DRY_RUN_CMD ln -s $VERBOSE_ARG \
|
||||||
|
''${builtins.toPath ./link-me-directly} $HOME
|
||||||
|
''';
|
||||||
|
}
|
||||||
|
'';
|
||||||
description = ''
|
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.
|
||||||
|
|
||||||
</para><para>
|
</para><para>
|
||||||
Any script should respect the <varname>DRY_RUN</varname>
|
|
||||||
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
|
||||||
|
<emphasis>must</emphasis> be placed after the special
|
||||||
|
<literal>writeBoundary</literal> 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
|
||||||
|
<literal>checkLinkTargets</literal> script block checks for
|
||||||
|
collisions between non-managed files and files defined in
|
||||||
|
<varname><link linkend="opt-home.file">home.file</link></varname>.
|
||||||
|
|
||||||
|
</para><para>
|
||||||
|
|
||||||
|
A script block should respect the <varname>DRY_RUN</varname>
|
||||||
|
variable, if it is set then the actions taken by the script
|
||||||
|
should be logged to standard out and not actually performed.
|
||||||
The variable <varname>DRY_RUN_CMD</varname> is set to
|
The variable <varname>DRY_RUN_CMD</varname> is set to
|
||||||
<code>echo</code> if dry run is enabled. Thus, many cases you
|
<command>echo</command> if dry run is enabled.
|
||||||
can use the idiom <code>$DRY_RUN_CMD rm -rf /</code>.
|
|
||||||
|
</para><para>
|
||||||
|
|
||||||
|
A script block should also respect the
|
||||||
|
<varname>VERBOSE</varname> variable, and if set print
|
||||||
|
information on standard out that may be useful for debugging
|
||||||
|
any issue that may arise. The variable
|
||||||
|
<varname>VERBOSE_ARG</varname> is set to
|
||||||
|
<option>--verbose</option> if verbose output is enabled.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue