1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-10 21:29:48 +01:00

home-environment: fix incompatible profile error

This fixes the error:

    error: profile '/nix/var/nix/profiles/per-user/enzime/profile' is incompatible with 'nix-env'; please use 'nix profile' instead
This commit is contained in:
Michael Hoang 2023-12-24 20:41:21 +11:00 committed by Mikilio
parent 07a186f6b9
commit 9013d09c2a
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -585,11 +585,15 @@ in
if config.submoduleSupport.externalPackageInstall if config.submoduleSupport.externalPackageInstall
then then
'' ''
if [[ -e ${cfg.profileDirectory}/manifest.json ]] ; then # We don't use `cfg.profileDirectory` here because it defaults to
# `/etc/profiles/per-user/<user>` which is constructed by NixOS or
# nix-darwin and won't require uninstalling `home-manager-path`.
if [[ -e $HOME/.nix-profile/manifest.json \
|| -e "''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/manifest.json" ]] ; then
nix profile list \ nix profile list \
| { grep 'home-manager-path$' || test $? = 1; } \ | { grep 'home-manager-path$' || test $? = 1; } \
| cut -d ' ' -f 4 \ | cut -d ' ' -f 4 \
| xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG | xargs -rt $DRY_RUN_CMD nix profile remove $VERBOSE_ARG
else else
if nix-env -q | grep '^home-manager-path$'; then if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env -e home-manager-path $DRY_RUN_CMD nix-env -e home-manager-path