Skip to content

Commit

Permalink
home-manager: set state version when uninstalling
Browse files Browse the repository at this point in the history
Otherwise the switch exits with an error.

Fixes nix-community#3320
  • Loading branch information
rycee committed Oct 11, 2022
1 parent e1f1160 commit ebe6d2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion home-manager/home-manager
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ function doUninstall() {
y|Y)
_i "Switching to empty Home Manager configuration..."
HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)"
echo "{ lib, ... }: { home.file = lib.mkForce {}; }" > "$HOME_MANAGER_CONFIG"
echo "{ lib, ... }: {" > "$HOME_MANAGER_CONFIG"
echo " home.file = lib.mkForce {};" >> "$HOME_MANAGER_CONFIG"
echo " home.stateVersion = \"18.09\";" >> "$HOME_MANAGER_CONFIG"
echo "}" >> "$HOME_MANAGER_CONFIG"
doSwitch
$DRY_RUN_CMD $REMOVE_CMD home-manager-path || true
rm "$HOME_MANAGER_CONFIG"
Expand Down

0 comments on commit ebe6d2c

Please sign in to comment.