Sync Obsidian vault continuously as a background service - #328
Open
crdant wants to merge 3 commits into
Open
Conversation
Add a programs.obsidian.sync.enable toggle to the obsidian home module that runs 'ob sync --continuous' in the Notes vault — a systemd user service on Linux, a launchd agent on Darwin. The service skips machines where obsidian-headless isn't configured yet. Enabled in the full profile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Default programs.obsidian.sync.enable to off and enable it through host-specific home configurations: mkHomeConfig now takes a hostname, home.nix layers in home/users/<user>/<host>.nix when one exists, and a crdant@mash configuration turns sync on for mash. As a bonus, 'home-manager switch --flake .' now resolves crdant@mash automatically on that host. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Move the per-host home override from home/users/crdant/mash.nix to systems/hosts/mash/home.nix so host configuration lives in one place. The crdant@mash home configuration imports it directly via a new extraModules argument on mkHomeConfig, replacing the hostname special-arg threading. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Keeps the Notes vault continuously synced in the background on machines that opt in: a new
programs.obsidian.sync.enabletoggle on the obsidian home module runsob sync --continuousas a systemd user service on Linux and a launchd agent on macOS. Sync is off by default and enabled per host — currently on mash.Details
Converts the obsidian home module to an options-style module (following the
programs.claudeconvention) so importing it and enabling sync are separate decisions.Adds host-specific home configurations:
mkHomeConfigtakesextraModules, and acrdant@mashhome configuration layerssystems/hosts/mash/home.nix— which enables sync — over the full profile, keeping host configuration together undersystems/hosts/<host>/. Since home-manager resolves$USER@$HOSTNAMEfirst,home-manager switch --flake .picks the host configuration automatically on mash.Guards the Linux unit with
ConditionPathExistson the obsidian-headless config so machines that haven't runob loginskip the service instead of crash-looping underRestart=on-failure. The launchd agent usesKeepAlive.SuccessfulExit = falsefor the same restart behavior on macOS.🤖 Generated with Claude Code