diff --git a/modules/environment/path.nix b/modules/environment/path.nix index 2c9d3a5..0673106 100644 --- a/modules/environment/path.nix +++ b/modules/environment/path.nix @@ -38,7 +38,19 @@ in build.activation.installPackages = '' if [[ -e "${config.user.home}/.nix-profile/manifest.json" ]]; then - $DRY_RUN_CMD nix profile install ${cfg.path} + # manual removal and installation as two non-atomical steps is required + # because of https://github.com/NixOS/nix/issues/6349 + + nix_previous="$(command -v nix)" + + nix profile list \ + | grep 'nix-on-droid-path$' \ + | cut -d ' ' -f 4 \ + | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG + + $DRY_RUN_CMD $nix_previous profile install ${cfg.path} + + unset nix_previous else $DRY_RUN_CMD nix-env --install ${cfg.path} fi