0

I have installed home-manager in a flake as a module.
The Flake and the Module are in /etc/nixos/.
My Home manager File links to another file in which I configure neovim, this file is located in /etc/nixos/config/nvim/nvim.nix.
The Contents of that file are

# neovim configuration file pkgs: { enable = true; vimAlias = true; # A simple configuration for neovim (sourced files) extraLuaConfig = '' -- Indentation vim.opt.smartindent = true vim.opt.autoindent = true -- UI settings vim.opt.number = true vim.opt.cursorline = true ''; plugins = with pkgs.vimPlugins; [ vim-nix yuck-vim markdown-preview-nvim { plugin = telescope-nvim; config = '' " Find files using Telescope command-line sugar. noremap <leader>ff <cmd>Telescope find_files<cr> nnoremap <leader>fg <cmd>Telescope live_grep<cr> nnoremap <leader>fb <cmd>Telescope buffers<cr> nnoremap <leader>fh <cmd>Telescope help_tags<cr> " Using Lua functions nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr> nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr> nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr> nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr> ''; } { type = "lua"; plugin = catppuccin-nvim; config = '' require("catppuccin").setup({ flavour = "mocha", -- latte, frappe, macchiato, mocha background = { -- :h background light = "latte", dark = "mocha", }, transparent_background = false, show_end_of_buffer = false, -- show the '~' characters after the end of buffers term_colors = false, dim_inactive = { enabled = false, shade = "dark", percentage = 0.15, }, no_italic = false, -- Force no italic no_bold = false, -- Force no bold styles = { comments = { "italic" }, conditionals = { "italic" }, loops = {}, functions = {}, keywords = {}, strings = {}, variables = {}, numbers = {}, booleans = {}, properties = {}, types = {}, operators = {}, }, color_overrides = {}, custom_highlights = {}, integrations = { cmp = true, gitsigns = true, nvimtree = true, telescope = true, notify = false, mini = false, -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) }, }) -- setup must be called before loading vim.cmd.colorscheme "catppuccin" ''; } nvim-web-devicons neo-tree-nvim { type = "lua"; plugin = nvim-treesitter; config = '' require'nvim-treesitter.configs'.setup { ensure_installed = "maintained", highlight = { enable = true, } } ''; } nvim-lspconfig rust-tools-nvim ]; extraPackages = with pkgs; [ tree-sitter rust-analyzer ripgrep nil zig ripgrep kotlin-language-server fd statix cppcheck deadnix alejandra nodePackages.pyright nodejs-16_x tree-sitter nil clang-tools cmake-language-server # ccls wl-clipboard omnisharp-roslyn netcoredbg gcc # treesitter nixfmt nodePackages.typescript-language-server python310Packages.autopep8 lazygit ]; } 

When I open a file, for example a *.lua I get the error Message:

Error detected while processing /home/simon/.config/nvim/init.lua: Could not create parser dir ' /nix/store/w3x3582xldrjymxbxz98lzlfmhazibmy-vim-pack-dir/pack/myNeovimPackages/start/nvim-treesitter/parser ': Vim:E739: Cannot create directory /nix/sto re/w3x3582xldrjymxbxz98lzlfmhazibmy-vim-pack-dir/pack/myNeovimPackages/start/nvim-treesitter/parser: read-only file system 

How can I fix this? Any help is greatly appreciated.

1 Answer 1

2

You install tree sitter grammars for nvim-treesitter using nvim-treesitter.withPlugins. Something like this should work out of the box

nvim-treesitter.withPlugins (ps: with ps; [ nix python ]) 

of if you want to install all the grammars:

nvim-treesitter.withAllGrammars 

This is documented in the vim section of NixOS manual

If you don't want to install nvim-treesitter grammars with nix, you can set the parser_install_dir to something writable, note that things might not work out of the box.

require("nvim-treesitter.configs").setup({ parser_install_dir = "/some/path/to/store/parsers", }) 

This information can be found by running :h nvim-treesitter-quickstart in your neovim.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.