no-mistakes(review): Purge leaked herdr runtime files from dotfiles repo on activation

This commit is contained in:
Lap Tran committed 2026-10-05 22:00:15 -04:00
1 parent 6e1ee6ef67
commit d5eb744fb4
1 file changed
+10 -1
+10 -1
View File
@@ -98,12 +98,21 @@ in
# to config.toml.backup and leave a symlink inside the tree. Drop the stale
# symlink before home-manager checks link targets; linkGeneration then creates
# the real directory. A real directory (the post-migration state) is left
# untouched, so this is idempotent.
# untouched, so this is idempotent. The old whole-directory symlink also left
# herdr runtime state (sockets, logs, session.json, session-snapshots/, ...) in
# this repo; that state now resolves to the real directory, so clear every
# leftover except the tracked config.toml. Unlinking a live socket or log only
# drops the path - the running herdr server keeps its own file handles.
home.activation.herdrConfigDir = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
set -euo pipefail
if [ -L "$HOME/.config/herdr" ]; then
rm "$HOME/.config/herdr"
fi
repoHerdr="${dotfiles}/home/.config/herdr"
if [ -d "$repoHerdr" ]; then
${pkgs.findutils}/bin/find "$repoHerdr" -mindepth 1 -maxdepth 1 \
! -name config.toml -exec ${pkgs.coreutils}/bin/rm -rf {} +
fi
'';
# Beets music library manager - managed by nixpkgs package, config symlinked below.