home-environment: extra message on nix-env error

When profile installation fails during activation we'll print an extra
message that explain that, if the error is due to conflicting
packages, then it may be that the user has a manually installed copy
of the package.

Fixes #1244
This commit is contained in:
Robert Helgesson 2021-04-29 17:53:56 +02:00
parent 137a584e22
commit d57c59e7cb
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -493,7 +493,24 @@ in
'' ''
else else
'' ''
$DRY_RUN_CMD nix-env -i ${cfg.path} if ! $DRY_RUN_CMD nix-env -i ${cfg.path} ; then
cat <<EOF
Oops, nix-env failed to install your new Home Manager profile!
Perhaps there is a conflict with a package that was installed using
'nix-env -i'? Try running
nix-env -q
and if there is a conflicting package you can remove it with
nix-env -e {package name}
Then try activating your Home Manager configuration again.
EOF
exit 1
fi
'' ''
); );