nix-community.nixvim/plugins/by-name/obsidian/default.nix
osbm a41559f093
Some checks are pending
Publish every Git push to main to FlakeHub / flakehub-publish (push) Waiting to run
Publish every git push to Flakestry / publish-flake (push) Waiting to run
Documentation / Version info (push) Waiting to run
Documentation / Build (push) Blocked by required conditions
Documentation / Combine builds (push) Blocked by required conditions
Documentation / Deploy (push) Blocked by required conditions
treewide: add plugin descriptions
2025-06-24 06:10:11 +00:00

109 lines
2.8 KiB
Nix

{
lib,
helpers,
config,
...
}:
with lib;
lib.nixvim.plugins.mkNeovimPlugin {
name = "obsidian";
packPathName = "obsidian.nvim";
package = "obsidian-nvim";
description = "Neovim plugin for writing and navigating Obsidian vaults.";
maintainers = [ maintainers.GaetanLepage ];
## DEPRECATIONS
# Introduced 2024-03-12
inherit (import ./deprecations.nix { inherit lib; })
imports
deprecateExtraOptions
optionsRenamedToSettings
;
settingsOptions =
let
opts = import ./settings-options.nix { inherit lib; };
in
{
dir = helpers.mkNullOrOption types.str ''
Alternatively to `workspaces` - and for backwards compatibility - you can set `dir` to a
single path instead of `workspaces`.
For example:
```nix
dir = "~/vaults/work";
```
'';
workspaces =
helpers.defaultNullOpts.mkNullable
(
with types;
listOf (
types.submodule {
options = {
name = mkOption {
type = with lib.types; maybeRaw str;
description = "The name for this workspace";
};
path = mkOption {
type = with lib.types; maybeRaw str;
description = "The path of the workspace.";
};
overrides = opts;
};
}
)
)
[ ]
''
A list of vault names and paths.
Each path should be the path to the vault root.
If you use the Obsidian app, the vault root is the parent directory of the `.obsidian`
folder.
You can also provide configuration overrides for each workspace through the `overrides`
field.
'';
}
// opts;
settingsExample = {
workspaces = [
{
name = "work";
path = "~/obsidian/work";
}
{
name = "startup";
path = "~/obsidian/startup";
}
];
new_notes_location = "current_dir";
completion = {
nvim_cmp = true;
min_chars = 2;
};
};
extraConfig = cfg: {
warnings = lib.nixvim.mkWarnings "plugins.obsidian" [
{
when = (cfg.settings.completion.nvim_cmp == true) && (!config.plugins.cmp.enable);
message = ''
You have enabled `completion.nvim_cmp` but `plugins.cmp.enable` is `false`.
You should probably enable `nvim-cmp`.
'';
}
{
when = (cfg.settings.completion.blink == true) && (!config.plugins.blink-cmp.enable);
message = ''
You have enabled `completion.blink` but `plugins.blink-cmp.enable` is `false`.
You should probably enable `blink-cmp`.
'';
}
];
};
}