diff --git a/home.nix b/home.nix index 1497fc6..68cb91b 100644 --- a/home.nix +++ b/home.nix @@ -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";