aboutsummaryrefslogtreecommitdiff
path: root/modules/users/editors/neovim/default.nix
blob: 975fae83cece22dc64c9b2f368c9afdeef3584a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
  config,
  username,
  lib,
  pkgs,
  ...
}:

let
  inherit (lib)
    mkOption
    types
    mkIf
    optionals
    ;
  cfg = config.nx.editors.neovim;
in
{
  options.nx.editors.neovim = {
    enable = mkOption {
      description = "Neovim editor";
      type = types.bool;
      default = true;
    };

    langs = {
      python = mkOption {
        description = "enable the python integration";
        type = types.bool;
        default = false;
      };
      go = mkOption {
        description = "enable go integration";
        type = types.bool;
        default = false;
      };
      ts = mkOption {
        description = "enable the js/ts integration";
        type = types.bool;
        default = false;
      };
      java = mkOption {
        description = "enable the java integration";
        type = types.bool;
        default = false;
      };
      nix = mkOption {
        description = "enable the nix integration";
        type = types.bool;
        default = true;
      };
      latex = mkOption {
        description = "enable latex integration";
        type = types.bool;
        default = false;
      };
    };
  };

  config = mkIf cfg.enable {
    programs.neovim = {
      defaultEditor = true;
      enable = true;
      package = pkgs.neovim-unwrapped;
      extraPackages =
        with pkgs;
        [
          tree-sitter
          git
          ripgrep
          fd
          gcc
        ]
        ++ (optionals cfg.langs.ts [ pkgs.nodePackages.typescript-language-server ])
        ++ (optionals cfg.langs.python [ ])
        ++ (optionals cfg.langs.go [ pkgs.gopls ])
        ++ (optionals cfg.langs.java [ pkgs.jdt-language-server ])
        ++ (optionals cfg.langs.nix [
          pkgs.nil
          pkgs.nixfmt-rfc-style
        ])
        ++ (optionals cfg.langs.latex [ pkgs.texlab ]);

      plugins = with pkgs.vimPlugins; [
        gruvbox-nvim
        mini-starter
        gitsigns-nvim
        nvim-autopairs
        telescope-nvim
        fidget-nvim
        plenary-nvim
        nvim-treesitter.withAllGrammars
        nvim-lspconfig
        nvim-cmp
        cmp-nvim-lsp
        cmp-buffer
        cmp-path
        cmp-cmdline
        luasnip
        cmp_luasnip
        lspkind-nvim
      ];

      extraConfig = ''
        luafile ${./init.lua}
      '';
    };
  };
}