1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

home-manager: set state version when uninstalling

Otherwise the switch exits with an error.

Fixes #3320

(cherry picked from commit ebe6d2c747)
This commit is contained in:
Robert Helgesson 2022-10-11 09:31:29 +02:00
parent 4a3d01fb53
commit 17208be516
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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"