Instead of an error
line 958: $1: unbound variable
we now emit an error such as
missing argument for --cores
Note, this is not perfect. In many cases you still get sub-optimal
error messages.
This removes the hard-coded fallback Home Manager paths. Specifically
${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager
and
"$HOME/.nixpkgs/home-manager"
Use `@HOME_MANAGER_PATH@` if it has been provided and points to
something that exists. Warn the user if it does not point to
something.
If we have not been provided with a `@HOME_MANAGER_PATH@` that exists,
then for both hard-coded paths show a warning if something exists
where the paths are pointing.
This no longer attempts to use either of the hard-coded paths as
fallback for the Home Manager path.
The generation activation script should be run by the user specified
in `home.username` and `home.homeDirectory`. If some other user runs
the activation script, then files may end up in the wrong place or
with the wrong owner.
This commits adds a check early in the activation script that verifies
that the running user match the user in the configuration.
Fixes#4019
If the user runs a recent Nix version that places per-user profiles in
`$XDG_STATE_DIR/nix/profiles`, then migrate the home-manager profile
there.
Also clean up `setupVars` a bit.
The init command is essentially the old install script but integrated
into the home-manager tool. This simplifies things slightly since we
can use the existing code infrastructure.
The init command is Nix flake aware in the sense that, if we detect
that the user's Nix setup supports flakes, then we also create an
initial `flake.nix` file.
Finally, we update the installation instructions for the Nix flakes
standalone setup to use the new init command.
Zsh completion update provided by Anund <anundm@gmail.com>.
This changes the default configuration location for Home Manager
configurations from
$XDG_CONFIG_HOME/nixpkgs
to
$XDG_CONFIG_HOME/home-manager
The old location is still supported but using it will trigger a
warning message.
Fixes#3640
Specifically, if the global per-user profiles path do not exist and we
cannot create it during the activation, then place our profile in the
Home Manager data directory. We prefer to use the global location,
though, since it makes it visible to `nix-collect-garbage`.
This is intended to improve compatibility with Nix version 2.14 and
later, which no longer creates the per-user directories.
Also, use the Home Manager data directory to manage the gcroot for the
current generation. It does not have to sit in the global per-user
gcroots directory since it should never be eligible for GC.