nvf icon indicating copy to clipboard operation
nvf copied to clipboard

orgmode treesitter grammar cannot be found

Open malikwirin opened this issue 9 months ago • 3 comments

⚠️ Please verify that this bug has NOT been reported before.

  • [x] I checked all existing issues and didn't find a similar issue

Description

Enabling treesitter and orgmode causes a build failure. It seems treesitter grammar for orgmode is not packaged in nixpkgs yet.

👟 Reproduction steps

Following config:

notes.orgmode.enable = true;
treesitter.enable = true;

👀 Expected behavior

No build failure

😓 Actual Behavior

Build failure

💻 Metadata

  • system: "x86_64-linux" - host os: Linux 6.6.83, NixOS, 24.11 (Vicuna), 24.11.20250319.57a0086 - multi-user?: yes - sandbox: yes - version: nix-env (Nix) 2.24.12 - nixpkgs: /nix/store/sp4fz08vkykgwp2yy8inl6890dl9a4jm-source

📝 Relevant log output

nix run .\#vim.default
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:34:12:
           33|
           34|   strict = derivationStrict drvAttrs;
             |            ^
           35|

       … while evaluating derivation 'nvf-with-helpers'
         whose name attribute is located at /nix/store/shh5sdqk4h0s482fxyyw6v5hhljapby9-source/pkgs/stdenv/generic/make-derivation.nix:375:7

       … while evaluating attribute 'paths' of derivation 'nvf-with-helpers'
         at /nix/store/shh5sdqk4h0s482fxyyw6v5hhljapby9-source/pkgs/build-support/trivial-builders/default.nix:542:9:
          541|         inherit preferLocalBuild allowSubstitutes;
          542|         paths = mapPaths (path: "${path}${stripPrefix}") paths;
             |         ^
          543|         passAsFile = [ "paths" ];

       … while evaluating the option `programs.mnw.plugins."[definition 1-entry 37]".dependencies':

       … while evaluating definitions from `<unknown-file>':

       … while evaluating the option `vim.treesitter.grammars':

       … while evaluating definitions from `/nix/store/wkg0s16q75w3pga99b8k0v1x4dabp588-source/modules/plugins/notes/orgmode/config.nix':

       … while evaluating the option `vim.notes.orgmode.treesitter.orgPackage':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: vimPlugins.nvim-treesitter.builtGrammars.org cannot be found in pkgs

malikwirin avatar Mar 22 '25 16:03 malikwirin

When disbaling orgmode treesitter

notes.orgmode = {
  enable = true;
  treesitter.enable = false;
};

The following error arrives:

Installing tree-sitter grammar...
Fehler beim Ausführen von "/nix/store/7fkksqxnv3yzi9vbgvc9r5rnyddlxyjs-neovim-pack-dir/init.lua":
E5113: Error while calling lua chunk: ...vim-pack-dir/pack/mnw/start/orgmode/lua/orgmode/init.lua:122: [orgmode] Failed to copy generated tree-sitter parser to runtime folder: EROFS: read-only file system: /home/malik/.cache/nvf/tree-sitter-org/parser.so -> /nix/store/7fkksqxnv3yzi9vbgvc9r5rnyddlxyjs-neovim-pack-dir/pack/mnw/start/orgmode/parser/org.so
stack traceback:
    [C]: in function 'install_grammar'
    ...vim-pack-dir/pack/mnw/start/orgmode/lua/orgmode/init.lua:122: in function 'setup'
    /nix/store/9bi84gq0klb2z308src824j3s0n24lv3-init.lua:954: in main chunk

Which was a cause for #732

malikwirin avatar Mar 22 '25 16:03 malikwirin

I'm guessing upstream has removed it? It looks like builtGrammars is no longer the valid approach either, which means we have to refactor our current system...

NotAShelf avatar Mar 22 '25 17:03 NotAShelf

With both options enabled (vim.notes.orgmode.enable = true; and vim.notes.orgmode.treesitter.enable = true;), i get the same error: error: vimPlugins.nvim-treesitter.builtGrammars.org cannot be found in pkgs

But strangely i get a different error when i set vim.notes.orgmode.treesitter.enable = false; :

error: builder for '/nix/store/g691whkpcrv0k4nc1mpayxgkwzr566kk-mnw-configDir.drv' failed with exit code 1;
       last 3 log lines:
       > structuredAttrs is enabled
       > ln: missing file operand
       > Try 'ln --help' for more information.
       For full logs, run:
         nix log /nix/store/g691whkpcrv0k4nc1mpayxgkwzr566kk-mnw-configDir.drv

( the nix log has exactly the same 3 lines as seen on screen around 'ln: missing file operand').

So we cannot even use it with treesitter disabled. Is there a manual workaround for users until it is fixed?

d4ve89 avatar Aug 15 '25 14:08 d4ve89