Make home rebuild script remove old home-manager-path installs
diff --git a/result b/result
new file mode 120000
index 0000000..7ae7463
--- /dev/null
+++ b/result
@@ -0,0 +1 @@
+/nix/store/14b6l35z7dpw0k1kk48gsiaqmc4kl8nk-home-manager-generation
\ No newline at end of file
diff --git a/scripts/rebuild-home.sh b/scripts/rebuild-home.sh
index abbc4ad..ff32c4f 100755
--- a/scripts/rebuild-home.sh
+++ b/scripts/rebuild-home.sh
@@ -9,4 +9,14 @@
/usr/bin/env git commit -am "$changes"
fi
-home-manager switch --flake .#$USER $1
+nix build .#homeConfigurations.${USER}.activationPackage $1
+
+nix profile list \
+ | { grep 'home-manager-path$' || test $? = 1; } \
+ | awk -F ' ' '{ print $4 }' \
+ | cut -d ' ' -f 4 \
+ | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG
+# ^ Remove old profiles; from https://github.com/nix-community/home-manager/blob/8d38ca886880265d523a66fe3da4d42e92ab0748/modules/home-environment.nix#L582
+
+result/activate
+unlink result