Obsidian: Difference between revisions
created basic page |
No edit summary |
||
| (8 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
Obsidian | {{Infobox application | ||
| name = Obsidian | |||
| type = Native | |||
| image = https://obsidian.md/favicon.svg | |||
| website = [https://obsidian.md obsidian.md] | |||
| github = obsidianmd | |||
| documentation = [https://help.obsidian.md Obsidian Help] | |||
| initialRelease = 10 March 2020 | |||
| os = Linux, macOS, Windows, iOS, Android | |||
}} | |||
{{Tip/unfree}} | |||
[https://obsidian.md '''Obsidian'''] is a proprietary note-taking application and Markdown editor. Notes are stored as regular files inside directories called ''vaults''. | |||
== Installation == | == Installation == | ||
environment.systemPackages = with pkgs; [ | === NixOS === | ||
obsidian | |||
]; | <syntaxhighlight lang="nix"> | ||
</syntaxhighlight> | { | ||
nixpkgs.config.allowUnfree = true; | |||
" | |||
environment.systemPackages = with pkgs; [ | |||
</syntaxhighlight> | obsidian | ||
]; | |||
} | |||
</syntaxhighlight> | |||
=== Home Manager === | |||
[[Home Manager]] can install Obsidian and manage settings for individual vaults. | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
programs.obsidian = { | |||
enable = true; | |||
vaults.notes.target = "Documents/Obsidian"; | |||
defaultSettings.app = { | |||
alwaysUpdateLinks = true; | |||
spellcheck = true; | |||
}; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
The vault path is relative to the user's home directory. The example above manages <code>~/Documents/Obsidian</code>. | |||
The <code>notes</code> attribute is only an internal Home Manager name. | |||
{{Note|Without a declared vault, Home Manager installs Obsidian but does not manage vault-specific settings, plugins or themes.}} | |||
== Core plugins == | |||
Core plugins are included with Obsidian and can be enabled declaratively: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
programs.obsidian.defaultSettings.corePlugins = [ | |||
"backlink" | |||
"bookmarks" | |||
"daily-notes" | |||
"file-explorer" | |||
"global-search" | |||
"templates" | |||
]; | |||
} | |||
</syntaxhighlight> | |||
{{Warning|This list is exhaustive. Core plugins omitted from it are disabled. Leave the option unset to manage core plugins through Obsidian.}} | |||
Plugin-specific settings can also be declared: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
programs.obsidian.defaultSettings.corePlugins = [ | |||
{ | |||
name = "daily-notes"; | |||
settings = { | |||
folder = "Daily"; | |||
format = "YYYY-MM-DD"; | |||
}; | |||
} | |||
{ | |||
name = "templates"; | |||
settings.folder = "Templates"; | |||
} | |||
]; | |||
} | |||
</syntaxhighlight> | |||
== Community plugins and themes == | |||
Home Manager supports packaged plugins and themes, but does not provide a package collection for them. | |||
The third-party [https://github.com/karaolidis/nix-obsidian-extensions nix-obsidian-extensions] flake provides packages from the official Obsidian registries. | |||
{{Warning|This flake is not part of Nixpkgs, Home Manager, nix-community or the NixOS project.}} | |||
=== Flake input === | |||
Add the input to <code>flake.nix</code>: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
inputs = { | |||
# ... | |||
obsidian-extensions = { | |||
url = "github:karaolidis/nix-obsidian-extensions"; | |||
inputs.nixpkgs.follows = "nixpkgs"; | |||
}; | |||
}; | |||
# ... | |||
} | |||
</syntaxhighlight> | |||
=== Overlay === | |||
Apply the overlay to the package set used by Home Manager: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
nixpkgs.overlays = [ | |||
inputs.obsidian-extensions.overlays.default | |||
]; | |||
} | |||
</syntaxhighlight> | |||
This adds: | |||
* <code>pkgs.obsidianPlugins</code> | |||
* <code>pkgs.obsidianThemes</code> | |||
When Home Manager is used as a NixOS module with <code>home-manager.useGlobalPkgs = true</code>, apply the overlay in the NixOS configuration. | |||
Standalone Home Manager supports the same <code>nixpkgs.overlays</code> option. | |||
=== Installing plugins and themes === | |||
<syntaxhighlight lang="nix"> | |||
{ pkgs, ... }: | |||
{ | |||
programs.obsidian = { | |||
enable = true; | |||
vaults.notes.target = "Documents/Obsidian"; | |||
defaultSettings = { | |||
communityPlugins = with pkgs.obsidianPlugins; [ | |||
dataview | |||
obsidian-git | |||
obsidian-importer | |||
vim-yank-highlight | |||
]; | |||
themes = with pkgs.obsidianThemes; [ | |||
catppuccin | |||
]; | |||
}; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
Plugin attributes use the IDs from the official Obsidian plugin registry. They do not always match the display names shown in Obsidian. | |||
Available extensions can be listed with: | |||
<syntaxhighlight lang="console"> | |||
# Plugins | |||
$ nix eval \ | |||
--json \ | |||
github:karaolidis/nix-obsidian-extensions#legacyPackages.x86_64-linux.obsidianPlugins \ | |||
--apply builtins.attrNames | |||
# Themes | |||
$ nix eval \ | |||
--json \ | |||
github:karaolidis/nix-obsidian-extensions#legacyPackages.x86_64-linux.obsidianThemes \ | |||
--apply builtins.attrNames | |||
</syntaxhighlight> | |||
Plugin settings can be written to their <code>data.json</code> files: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
programs.obsidian.defaultSettings.communityPlugins = [ | |||
{ | |||
pkg = pkgs.obsidianPlugins.example-plugin; | |||
settings = { | |||
exampleOption = true; | |||
}; | |||
} | |||
]; | |||
} | |||
</syntaxhighlight> | |||
== Declarative and manual management == | |||
Declaratively managed plugins and themes are linked from the immutable Nix store. | |||
Therefore: | |||
* they generally cannot be updated from Obsidian; | |||
* manual changes may be replaced on the next activation; | |||
* removing them from the Nix configuration removes them from the managed vault. | |||
To manage plugins and themes manually, leave their options unset: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
programs.obsidian = { | |||
enable = true; | |||
vaults.notes.target = "Documents/Obsidian"; | |||
defaultSettings = { | |||
communityPlugins = null; | |||
themes = null; | |||
}; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
Both options are <code>null</code> by default. | |||
== Applying the configuration == | |||
<syntaxhighlight lang="console"> | |||
# NixOS | |||
$ sudo nixos-rebuild switch --flake . | |||
# Standalone Home Manager | |||
$ home-manager switch --flake . | |||
</syntaxhighlight> | |||
== See also == | |||
* [https://help.obsidian.md Obsidian documentation] | |||
* [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.obsidian.enable Home Manager options] | |||
* [https://github.com/karaolidis/nix-obsidian-extensions nix-obsidian-extensions] | |||
* [[Home Manager]] | |||
* [[Logseq]] | |||
[[Category:Applications]] | |||
[[Category:Note taking]] | |||
Latest revision as of 16:54, 1 August 2026
Obsidian is a proprietary note-taking application and Markdown editor. Notes are stored as regular files inside directories called vaults.
Installation
NixOS
{
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
obsidian
];
}
Home Manager
Home Manager can install Obsidian and manage settings for individual vaults.
{
programs.obsidian = {
enable = true;
vaults.notes.target = "Documents/Obsidian";
defaultSettings.app = {
alwaysUpdateLinks = true;
spellcheck = true;
};
};
}
The vault path is relative to the user's home directory. The example above manages ~/Documents/Obsidian.
The notes attribute is only an internal Home Manager name.
Core plugins
Core plugins are included with Obsidian and can be enabled declaratively:
{
programs.obsidian.defaultSettings.corePlugins = [
"backlink"
"bookmarks"
"daily-notes"
"file-explorer"
"global-search"
"templates"
];
}
Plugin-specific settings can also be declared:
{
programs.obsidian.defaultSettings.corePlugins = [
{
name = "daily-notes";
settings = {
folder = "Daily";
format = "YYYY-MM-DD";
};
}
{
name = "templates";
settings.folder = "Templates";
}
];
}
Community plugins and themes
Home Manager supports packaged plugins and themes, but does not provide a package collection for them.
The third-party nix-obsidian-extensions flake provides packages from the official Obsidian registries.
Flake input
Add the input to flake.nix:
{
inputs = {
# ...
obsidian-extensions = {
url = "github:karaolidis/nix-obsidian-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
};
# ...
}
Overlay
Apply the overlay to the package set used by Home Manager:
{
nixpkgs.overlays = [
inputs.obsidian-extensions.overlays.default
];
}
This adds:
pkgs.obsidianPluginspkgs.obsidianThemes
When Home Manager is used as a NixOS module with home-manager.useGlobalPkgs = true, apply the overlay in the NixOS configuration.
Standalone Home Manager supports the same nixpkgs.overlays option.
Installing plugins and themes
{ pkgs, ... }:
{
programs.obsidian = {
enable = true;
vaults.notes.target = "Documents/Obsidian";
defaultSettings = {
communityPlugins = with pkgs.obsidianPlugins; [
dataview
obsidian-git
obsidian-importer
vim-yank-highlight
];
themes = with pkgs.obsidianThemes; [
catppuccin
];
};
};
}
Plugin attributes use the IDs from the official Obsidian plugin registry. They do not always match the display names shown in Obsidian.
Available extensions can be listed with:
# Plugins
$ nix eval \
--json \
github:karaolidis/nix-obsidian-extensions#legacyPackages.x86_64-linux.obsidianPlugins \
--apply builtins.attrNames
# Themes
$ nix eval \
--json \
github:karaolidis/nix-obsidian-extensions#legacyPackages.x86_64-linux.obsidianThemes \
--apply builtins.attrNames
Plugin settings can be written to their data.json files:
{
programs.obsidian.defaultSettings.communityPlugins = [
{
pkg = pkgs.obsidianPlugins.example-plugin;
settings = {
exampleOption = true;
};
}
];
}
Declarative and manual management
Declaratively managed plugins and themes are linked from the immutable Nix store.
Therefore:
- they generally cannot be updated from Obsidian;
- manual changes may be replaced on the next activation;
- removing them from the Nix configuration removes them from the managed vault.
To manage plugins and themes manually, leave their options unset:
{
programs.obsidian = {
enable = true;
vaults.notes.target = "Documents/Obsidian";
defaultSettings = {
communityPlugins = null;
themes = null;
};
};
}
Both options are null by default.
Applying the configuration
# NixOS
$ sudo nixos-rebuild switch --flake .
# Standalone Home Manager
$ home-manager switch --flake .