From 17208be516fc36e2ab0ceb064d931e90eb88b2a3 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 11 Oct 2022 09:31:29 +0200 Subject: [PATCH] home-manager: set state version when uninstalling Otherwise the switch exits with an error. Fixes #3320 (cherry picked from commit ebe6d2c747cc6e2223dd5962bdca258088518b3f) --- home-manager/home-manager | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index 6483c59f..cbf3e883 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -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"