From c4bbbd9096a1571221360c972ef43c044a271c14 Mon Sep 17 00:00:00 2001 From: alfarel Date: Fri, 31 Oct 2025 18:28:01 +0000 Subject: [PATCH 1/5] pins: switch to maintained obsidian.nvim fork, use stable releases Stable releases are regular and compatible with the latest packaged nvim versions from nixpkgs. --- npins/sources.json | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/npins/sources.json b/npins/sources.json index a9df47b7..a599f8b4 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -2108,17 +2108,20 @@ "hash": "1qbyh8r2gbaw2n0mm7qwi4y8r9ywyz37q35vlxjzy879ba8dlnlm" }, "obsidian-nvim": { - "type": "Git", + "type": "GitRelease", "repository": { "type": "GitHub", - "owner": "epwalsh", + "owner": "obsidian-nvim", "repo": "obsidian.nvim" }, - "branch": "main", + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, "submodules": false, - "revision": "14e0427bef6c55da0d63f9a313fd9941be3a2479", - "url": "https://github.com/epwalsh/obsidian.nvim/archive/14e0427bef6c55da0d63f9a313fd9941be3a2479.tar.gz", - "hash": "15ycmhn48ryaqzch6w3w6llq2qgmjx8xwkb9dn0075z60dybpflr" + "version": "v3.15.3", + "revision": "3121b4b52a167949c4126254272346d363cc92b6", + "url": "https://api.github.com/repos/obsidian-nvim/obsidian.nvim/tarball/v3.15.3", + "hash": "0m6lwqb2y19xrs11hj818ja36z5ql34xk81x393b20jwnd0bar5l" }, "oil-git-status.nvim": { "type": "Git", From 5a50f0416badc4766e255f3a472c2c64c0883503 Mon Sep 17 00:00:00 2001 From: alfarel Date: Fri, 31 Oct 2025 19:46:43 +0000 Subject: [PATCH 2/5] notes/obsidian-nvim: remove unnecessary options and add integrations/compat --- docs/manual/release-notes/rl-0.9.md | 72 ++++++++++++++++++ modules/plugins/notes/obsidian/config.nix | 57 +++++++++++++-- modules/plugins/notes/obsidian/obsidian.nix | 81 ++++++++++++--------- 3 files changed, 171 insertions(+), 39 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 9b5d2d29..e09fa24f 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -10,6 +10,24 @@ Additionally, built grammars **no longer include queries by default**, therefore queries not managed by nvf will lack their respective syntax highlighting capabilities. +- [obsidian.nvim] now uses a maintained fork which has removed the `dir` + setting. Use `workspaces` instead: + + ```nix + { + workspaces = [ + { + name = "any-string"; + path = "~/old/dir/path/value"; + } + ]; + } + ``` + + Some other settings and commands are now deprecated but are still supported. + + - The `setupOpts.mappings` options were also removed. Use the built-in + Neovim settings (nvf's {option}`vim.keymaps`) ## Changelog {#sec-release-0-9-changelog} @@ -40,3 +58,57 @@ [Libadoxon](https://github.com/Libadoxon): - `toggleterm` open map now also works when in terminal mode + +[alfarel](https://github.com/alfarelcynthesis): + +[obsidian.nvim]: https://github.com/obsidian-nvim/obsidian.nvim +[blink.cmp]: https://cmp.saghen.dev/ +[snacks.nvim]: https://github.com/folke/snacks.nvim +[mini.nvim]: https://nvim-mini.org/mini.nvim/ +[telescope.nvim]: https://github.com/nvim-telescope/telescope.nvim +[fzf-lua]: https://github.com/ibhagwan/fzf-lua +[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim +[markview.nvim]: https://github.com/OXY2DEV/markview.nvim +[which-key.nvim]: https://github.com/folke/which-key.nvim + +- Upgrade [obsidian.nvim] to use a maintained fork, instead of the unmaintained + upstream. + - Various upstream improvements: + - Support [blink.cmp] and completion plugin autodetection. + - Support various pickers for prompts, including [snacks.nvim]'s + `snacks.picker`, [mini.nvim]'s `mini.pick`, [telescope.nvim], and + [fzf-lua]. + - Merge commands like `ObsidianBacklinks` into `Obisidian backlinks`. The + old format is still supported by default. + - Some `setupOpts` options have changed: + - `disable_frontmatter` -> `frontmatter.enabled` (and inverted), still + supported. + - `note_frontmatter_func` -> `frontmatter.func`, still supported. + - `statusline` module is now deprecated in favour of `footer`, still + supported. + - `dir` is no longer supported, use `workspaces`: + + ```nix + { + workspaces = [ + { + name = "any-string"; + path = "~/old/dir/path/value"; + } + ]; + } + ``` + + - `use_advanced_uri` -> `open.use_advanced_uri`. + - Mappings are now expected to be set using the built-in Neovim APIs, + managed by `vim.keymaps` in nvf, instead of `mappings` options. + - Some option defaults have changed. + - And more. + - Automatically configure an enabled picker in the order mentioned above, if + any are enabled. + - Add integration with `snacks.image` for rendering workspace/vault assets. + - Detect if [render-markdown.nvim] or [markview.nvim] are enabled and disable + the `ui` module if so. It should work without this, but `render-markdown`'s + {command}`:healthcheck` doesn't know that. + - Remove [which-key.nvim] `o` `+Notes` description which did not + actually correspond to any keybinds. diff --git a/modules/plugins/notes/obsidian/config.nix b/modules/plugins/notes/obsidian/config.nix index 835bc17c..145ddff7 100644 --- a/modules/plugins/notes/obsidian/config.nix +++ b/modules/plugins/notes/obsidian/config.nix @@ -3,9 +3,9 @@ lib, ... }: let - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.binds) pushDownDefault; inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.notes.obsidian; @@ -18,13 +18,58 @@ in { "tabular" ]; - binds.whichKey.register = pushDownDefault { - "o" = "+Notes"; - }; - pluginRC.obsidian = entryAnywhere '' require("obsidian").setup(${toLuaObject cfg.setupOpts}) ''; + + notes.obsidian.setupOpts = let + # may not be defined + snacks-picker.enable = config.vim.utility.snacks-nvim.setupOpts.picker.enabled or false; + mini-pick = config.vim.mini.pick; + inherit (config.vim) telescope fzf-lua; + + inherit (config.vim.languages.markdown.extensions) render-markdown-nvim markview-nvim; + in + mkMerge [ + # Don't set option unless we have a useful setting for it. + (mkIf (snacks-picker.enable || mini-pick.enable || telescope.enable || fzf-lua.enable) { + # It doesn't detect/choose this. + # Some pickers and completion plugins don't get detected correctly by the checkhealth, but they all work. + # Values taken from the [config's](https://github.com/obsidian-nvim/obsidian.nvim/blob/main/lua/obsidian/config/init.lua) valid ones. + picker.name = + if snacks-picker.enable + then "snacks.pick" + else if mini-pick.enable + then "mini.pick" + else if telescope.enable + then "telescope.nvim" + else if fzf-lua.enable + then "fzf-lua" + # NOTE: Shouldn't happen with the if-guard. + else null; + }) + + # Should be disabled automatically, but still shows up in render-markdown's checkhealth. + # This is also useful in that it will conflict with a user explicitly enabling it + # without mkForce, which is probably a copy paste issue and a sign to look at + # whether this option is useful. + (mkIf (render-markdown-nvim.enable || markview-nvim.enable) {ui.enable = false;}) + ]; + + # Resolve markdown image paths in the vault. + # Only actually used by snacks if image.enabled is set to true and + # required programs are supplied and `attachments.img_folder` is correct. + # From https://github.com/obsidian-nvim/obsidian.nvim/wiki/Images, + # which notes the API might change. + utility.snacks-nvim.setupOpts = mkIf config.vim.utility.snacks-nvim.enable { + image.resolve = mkLuaInline '' + function(path, src) + if require("obsidian.api").path_is_note(path) then + return require("obsidian.api").resolve_image_path(src) + end + end + ''; + }; }; }; } diff --git a/modules/plugins/notes/obsidian/obsidian.nix b/modules/plugins/notes/obsidian/obsidian.nix index 17369b88..15cdf33f 100644 --- a/modules/plugins/notes/obsidian/obsidian.nix +++ b/modules/plugins/notes/obsidian/obsidian.nix @@ -1,14 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) bool str nullOr; - inherit (lib.modules) mkRenamedOptionModule; +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkRenamedOptionModule mkRemovedOptionModule; inherit (lib.nvim.types) mkPluginSetupOption; - - autocompleteCfg = config.vim.autocomplete; in { imports = let renamedSetupOption = oldPath: newPath: @@ -16,38 +9,60 @@ in { (["vim" "notes" "obsidian"] ++ oldPath) (["vim" "notes" "obsidian" "setupOpts"] ++ newPath); in [ - (renamedSetupOption ["dir"] ["dir"]) + ( + mkRemovedOptionModule ["vim" "notes" "obsidian" "dir"] + '' + `obsidian.nvim` has migrated to the `setupOpts.workspaces` option to support multiple vaults with a single interface. + + To continue using a single vault, set: + + ```nix + { + notes.obsidian.setupOpts.workspaces = [ + { + name = "any-string"; + path = "~/old/dir/path/value"; + } + ]; + } + ``` + + See the [wiki](https://github.com/obsidian-nvim/obsidian.nvim/wiki/Workspace#vault-based-workspaces) for more information. + '' + ) (renamedSetupOption ["daily-notes" "folder"] ["daily_notes" "folder"]) (renamedSetupOption ["daily-notes" "date-format"] ["daily_notes" "date_format"]) (renamedSetupOption ["completion"] ["completion"]) ]; + options.vim.notes = { obsidian = { - enable = mkEnableOption "complementary neovim plugins for Obsidian editor"; + enable = + mkEnableOption "" + // { + description = '' + Whether to enable plugins to complement the Obsidian markdown editor [obsidian.nvim]. - setupOpts = mkPluginSetupOption "Obsidian.nvim" { - daily_notes = { - folder = mkOption { - type = nullOr str; - default = null; - description = "Directory in which daily notes should be created"; - }; - date_format = mkOption { - type = nullOr str; - default = null; - description = "Date format used for creating daily notes"; - }; + Enables [vim-markdown] which automatically folds markdown headings inside and outside of workspaces/vaults. + Set {option}`vim.globals.vim_markdown_folding_disable = 1;` to disable automatic folding, + or {option}`vim.globals.vim_markdown_folding_level = ;` to set the default fold level for new buffers. + + nvf will choose one of `snacks.picker`, `mini.pick`, `telescope`, or `fzf-lua` as the `obsidian.nvim` picker based on whether they are enabled, in that order. + + You can enable one of them with one of the following: + + - {option}`vim.utility.snacks-nvim.setupOpts.picker.enabled` and {option}`vim.utility.snacks-nvim.enable` + - {option}`vim.mini.pick.enable` + - {option}`vim.telescope.enable` + - {option}`vim.fzf-lua.enable` + + {option}`vim.notes.obsidian.setupOpts.ui.enable` is automatically disabled if `render-markdown.nvim` or `markview.nvim` are enabled. + + [vim-markdown]: https://github.com/preservim/vim-markdown?tab=readme-ov-file#options + ''; }; - completion = { - nvim_cmp = mkOption { - # If using nvim-cmp, otherwise set to false - type = bool; - description = "If using nvim-cmp, otherwise set to false"; - default = autocompleteCfg.nvim-cmp.enable || autocompleteCfg.blink-cmp.enable; - }; - }; - }; + setupOpts = mkPluginSetupOption "obsidian.nvim" {}; }; }; } From 049d7f707f6fbddf962a0eae91cfdca44f434c6c Mon Sep 17 00:00:00 2001 From: alfarel Date: Fri, 31 Oct 2025 19:47:24 +0000 Subject: [PATCH 3/5] docs/modules: remove outdated and incorrect input-following suggestions --- docs/manual/installation/modules/home-manager.md | 13 +++---------- docs/manual/installation/modules/nixos.md | 14 +++----------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/docs/manual/installation/modules/home-manager.md b/docs/manual/installation/modules/home-manager.md index 916208ce..f5d85b72 100644 --- a/docs/manual/installation/modules/home-manager.md +++ b/docs/manual/installation/modules/home-manager.md @@ -19,20 +19,13 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # flake.nix { inputs = { - # Optional, if you intend to follow nvf's obsidian-nvim input - # you must also add it as a flake input. - obsidian-nvim.url = "github:epwalsh/obsidian.nvim"; - - # Required, nvf works best and only directly supports flakes + # nvf works best with and only directly supports flakes nvf = { url = "github:NotAShelf/nvf"; # You can override the input nixpkgs to follow your system's # instance of nixpkgs. This is safe to do as nvf does not depend # on a binary cache. inputs.nixpkgs.follows = "nixpkgs"; - # Optionally, you can also override individual plugins - # for example: - inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs }; # ... @@ -44,8 +37,8 @@ Followed by importing the home-manager module somewhere in your configuration. ```nix { - # Assuming "nvf" is in your inputs and inputs is in the argument set. - # See example installation below + # Assuming nvf is in your inputs and inputs is in the argument set. + # See example installation below. imports = [ inputs.nvf.homeManagerModules.default ]; } ``` diff --git a/docs/manual/installation/modules/nixos.md b/docs/manual/installation/modules/nixos.md index 0186465b..95a0fc8f 100644 --- a/docs/manual/installation/modules/nixos.md +++ b/docs/manual/installation/modules/nixos.md @@ -19,20 +19,13 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # flake.nix { inputs = { - # Optional, if you intend to follow nvf's obsidian-nvim input - # you must also add it as a flake input. - obsidian-nvim.url = "github:epwalsh/obsidian.nvim"; - - # Required, nvf works best and only directly supports flakes + # nvf works best with and only directly supports flakes nvf = { url = "github:NotAShelf/nvf"; # You can override the input nixpkgs to follow your system's # instance of nixpkgs. This is safe to do as nvf does not depend # on a binary cache. inputs.nixpkgs.follows = "nixpkgs"; - # Optionally, you can also override individual plugins - # for example: - inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs }; # ... @@ -44,8 +37,8 @@ Followed by importing the NixOS module somewhere in your configuration. ```nix { - # assuming nvf is in your inputs and inputs is in the argset - # see example below + # Assuming nvf is in your inputs and inputs is in the argument set. + # See example below. imports = [ inputs.nvf.nixosModules.default ]; } ``` @@ -79,7 +72,6 @@ configure **nvf**. { programs.nvf = { enable = true; - # Your settings need to go into the settings attribute set # most settings are documented in the appendix settings = { From b10c506db3caafc46d44027e6672f8d494f7462f Mon Sep 17 00:00:00 2001 From: alfarel Date: Fri, 31 Oct 2025 19:47:49 +0000 Subject: [PATCH 4/5] configuration.nix: don't use obsidian.nvim Obsidian essentially requires direct configuration, is not for a generic config example config. It isn't enabled now, so removing it should be fine. --- configuration.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/configuration.nix b/configuration.nix index cc314288..e3b85f92 100644 --- a/configuration.nix +++ b/configuration.nix @@ -214,7 +214,6 @@ isMaximal: { }; notes = { - obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled neorg.enable = false; orgmode.enable = false; mind-nvim.enable = isMaximal; From a0825441450fc91a0a8953733c00bd1a8dba1cb0 Mon Sep 17 00:00:00 2001 From: alfarel Date: Sat, 20 Dec 2025 07:31:12 +0000 Subject: [PATCH 5/5] notes/obsidian-nvim: fix checkhealth by building from pin manually --- modules/wrapper/build/config.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index 68b2c00d..ef1c2893 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -46,6 +46,21 @@ # Disable failing require check hook checks doCheck = false; }; + # Checkhealth fails to get the plugin's commit and therefore to + # show the rest of the useful diagnostics if not built like this. + obsidian-nvim = pkgs.vimUtils.buildVimPlugin { + # If set to `"obsidian-nvim"`, this breaks like `buildPlug` and `noBuildPlug`. + name = "obsidian.nvim"; + src = getPin "obsidian-nvim"; + nvimSkipModules = [ + "minimal" + # require picker plugins + "obsidian.picker._telescope" + "obsidian.picker._snacks" + "obsidian.picker._fzf" + "obsidian.picker._mini" + ]; + }; # Get plugins built from source from self.packages # If adding a new plugin to be built from source, it must also be inherited