Sample Header Ad - 728x90

treesitter Neovim plugin not working on nixos

0 votes
1 answer
1868 views
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 ff Telescope find_files
nnoremap fg Telescope live_grep
nnoremap fb Telescope buffers
nnoremap fh Telescope help_tags

" Using Lua functions
nnoremap ff lua require('telescope.builtin').find_files()
nnoremap fg lua require('telescope.builtin').live_grep()
nnoremap fb lua require('telescope.builtin').buffers()
nnoremap fh lua require('telescope.builtin').help_tags()
              '';

    }
    {
      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.
Asked by Zxmon (3 rep)
Feb 11, 2023, 06:03 PM
Last activity: Feb 11, 2023, 06:38 PM