Same motivation as in https://github.com/NixOS/nixpkgs/pull/28378.
zsh.initExtra parameter can be used by external modules which can
redefine user aliases. This change will give user-defined aliases
the highest priority.
This command allows the user to examine the news items generated by
the news module. See #52.
Many thanks to @nonsequitur and @uvNikita for suggestions and
improvements.
Using `--no-out-link` is convenient but it does not set up a GC root,
so an unfortunately timed GC could remove the generation before
activation completes. Many thanks to @nonsequitur for noting this
problem.
1. It slows down the initial start: it takes around 2s at first launch,
and around 0.25s for the following launches;
2. It seems to be redundant since just installing zsh package gives
working completions with correct $fpath set.
There is no need to specify an out link when switching to a new
generation since nix-build prints the store path on standard output.
Similarly, when just building a generation we specify no out link
since nix-build will use "result" by default.
Technically not necessary but it was a bit silly to leave out this
important directory from the generation directory. This also makes it
more convenient to browse the installed packages after a
`home-manager build`.
With --ignore-fail-on-non-empty, non-emptiness is the only failure
that gets ignored by rmdir. In the case that rmdir reaches $HOME and
considers deleting it, it will detect insufficient permissions and
subsequently exit with an error, even if $HOME is not empty.
Prevent this by calling rmdir with a relative path that excludes
$HOME.
Run the activation script in its original nix-store location so that
Bash error messages show the real script location instead of 'wrkdir',
which gets deleted right after the script exits.
Because 'set -e' has no effect on commands that run in an if condition,
the script was always exiting with no error when 'doBuild' failed.
As a bonus, $wrkdir is now always removed after building.