Nixsync
approvedby rowmayne
This plugin has not been manually reviewed by Obsidian staff. Export and import vault settings and plugins as Nix.
nixsync
Export and import vault settings and plugins as Nix.
What it does
Export dumps your Obsidian config to a single .nix file:
# obsidian.nix
{
config = {
app = { ... };
appearance = { ... };
hotkeys = { ... };
};
plugins = {
dataview = {
manifest = { ... };
settings = { ... };
};
};
}
Import reads that file back and writes config + plugin settings to .obsidian/.
Usage
Open command palette:
- Export settings as Nix file - writes
obsidian.nixto vault root - Import settings from Nix file - pick a
.nixfile, applies settings (reload Obsidian after)
Settings
| Setting | Default | Description |
|---|---|---|
| Export file name | obsidian.nix | Output file name |
| Open after export | on | Opens exported file in Obsidian |
| App config | on | app.json - editor, default view |
| Appearance | on | appearance.json - theme, font, accent |
| Core plugins | on | core-plugins.json - enabled built-ins |
| Graph settings | on | graph.json |
| Workspace | on | workspace.json - panel layout |
| Strip ephemeral workspace fields | on | Removes last-open files, active file, panel state (machine-specific) |
| Hotkeys | on | hotkeys.json |
| Community plugins | on | Plugin manifests |
| Plugin settings | on | Plugin data.json - disable if configs contain secrets |
| Generate NixOS integration files | off | Also exports obsidian-activate.sh |
NixOS integration
Enable Generate NixOS integration files to also export obsidian-activate.sh.
The script takes the exported .nix file, evaluates it with nix eval --json, and writes config + plugin files to ~/.obsidian/. Requires nix and jq.
bash obsidian-activate.sh /path/to/obsidian.nix
Note: restores settings and plugin data only. Plugin JS files are not included - Obsidian still needs to download plugins itself.
home-manager
home.file.".obsidian-config/export.nix".source = ./dotfiles/obsidian.nix;
home.activation.obsidian-restore = lib.hm.dag.entryAfter ["writeBoundary"] ''
${pkgs.bash}/bin/bash ${./dotfiles/obsidian-activate.sh} \
$HOME/.obsidian-config/export.nix
'';
configuration.nix
system.activationScripts.obsidian-restore = {
text = ''
${pkgs.bash}/bin/bash /etc/obsidian-activate.sh /etc/obsidian.nix
'';
};
environment.etc."obsidian.nix".source = ./dotfiles/obsidian.nix;
environment.etc."obsidian-activate.sh".source = ./dotfiles/obsidian-activate.sh;
Limitations
The import parser handles literal Nix values only: strings, numbers, booleans, null, arrays, and attribute sets. If you hand-edit the exported .nix file and add Nix-specific syntax — string interpolation (${...}), function calls, let/in expressions, or import — the import command will fail or silently corrupt those values. Keep the file as plain data; use the activation script for evaluated Nix. Feel free to fix this, I do not know when I will get around to this.
Sync workflow
# Machine A - after updating settings
# Command palette → Export settings as Nix file
git add obsidian.nix && git commit -m "chore: update obsidian settings"
git push
# Machine B
git pull
bash obsidian-activate.sh obsidian.nix
# restart Obsidian
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.