Nixsync

approved

by rowmayne

This plugin has not been manually reviewed by Obsidian staff. Export and import vault settings and plugins as Nix.

24 downloadsUpdated 1mo agoMIT

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.nix to vault root
  • Import settings from Nix file - pick a .nix file, applies settings (reload Obsidian after)

Settings

SettingDefaultDescription
Export file nameobsidian.nixOutput file name
Open after exportonOpens exported file in Obsidian
App configonapp.json - editor, default view
Appearanceonappearance.json - theme, font, accent
Core pluginsoncore-plugins.json - enabled built-ins
Graph settingsongraph.json
Workspaceonworkspace.json - panel layout
Strip ephemeral workspace fieldsonRemoves last-open files, active file, panel state (machine-specific)
Hotkeysonhotkeys.json
Community pluginsonPlugin manifests
Plugin settingsonPlugin data.json - disable if configs contain secrets
Generate NixOS integration filesoffAlso 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.