fix(home): stop herdr writing runtime state into the repo
herdr resolves its config directory as ~/.config/herdr and writes all of its runtime state beside config.toml: herdr.sock, herdr-client.sock, herdr-server.log, .plugins.lock, session.json and session-snapshots/. It offers no option to relocate that directory, so linking the whole directory into this repo made ~/.config/herdr resolve into the tracked tree and left every clone permanently dirty with herdr's live sockets and snapshots. Link only config.toml and let ~/.config/herdr be a real directory, so herdr's state lands in $HOME instead of the working tree. home-manager links a file by resolving the existing directory symlink, which would move this repo's own tracked config.toml to config.toml.backup and leave a symlink inside the tree. Add a one-time activation step that drops the stale symlink before home-manager checks link targets; it is a no-op once ~/.config/herdr is a real directory.
This commit is contained in:
1 parent
6e0bc81e85
commit
6e1ee6ef67
1 file changed
+22
-2
@@ -81,11 +81,31 @@ in
|
||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/nvim";
|
||||
force = true;
|
||||
};
|
||||
home.file.".config/herdr" = {
|
||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/herdr";
|
||||
# herdr treats ~/.config/herdr as both its config directory and its state
|
||||
# directory: it writes herdr.sock, herdr-client.sock, herdr-server.log,
|
||||
# .plugins.lock, session.json and session-snapshots/ beside config.toml, and it
|
||||
# offers no option to relocate them. Keep that directory a real directory and
|
||||
# link only the config file - a whole-directory symlink into this repo makes
|
||||
# every running herdr server dirty the working tree.
|
||||
home.file.".config/herdr/config.toml" = {
|
||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/herdr/config.toml";
|
||||
force = true;
|
||||
};
|
||||
|
||||
# Migration from the previous whole-directory symlink at ~/.config/herdr.
|
||||
# home-manager links ~/.config/herdr/config.toml by following the existing
|
||||
# ~/.config/herdr symlink, which would move this repo's own tracked config.toml
|
||||
# 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.
|
||||
home.activation.herdrConfigDir = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
|
||||
set -euo pipefail
|
||||
if [ -L "$HOME/.config/herdr" ]; then
|
||||
rm "$HOME/.config/herdr"
|
||||
fi
|
||||
'';
|
||||
|
||||
# Beets music library manager - managed by nixpkgs package, config symlinked below.
|
||||
home.file.".config/beets" = {
|
||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/beets";
|
||||
|
||||
Reference in new issue
Block a user