home-environment: support recent Nix versions

Recent Nix versions fail when running `nix profile remove` with no
argument. If packages are externally managed, and we have nothing to
remove, do not run the `nix profile remove` command.
This commit is contained in:
Minijackson 2024-04-14 09:46:58 +02:00 committed by Robert Helgesson
parent 4370b09cde
commit ab5542e9db
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -589,7 +589,7 @@ in
nix profile list \
| { grep 'home-manager-path$' || test $? = 1; } \
| 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
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env -e home-manager-path