summaryrefslogtreecommitdiff
path: root/neovim.nix
blob: 3fbe3d7711c98b90c53904433cd677b59fc3f607 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{self, ...}: {
  perSystem = {
    lib,
    pkgs,
    self',
    inputs',
    ...
  }: let
    plugins = with pkgs.vimPlugins; [
      # general
      catppuccin-nvim

      # TODO: don't pin when deprecation notice
      # is no longer in nixpkgs
      (fidget-nvim.overrideAttrs (_: {
        src = pkgs.fetchFromGitHub {
          owner = "j-hui";
          repo = "fidget.nvim";
          rev = "41f327b53c7977d47aee56f05e0bdbb4b994c5eb";
          hash = "sha256-v9qARsW8Gozit4Z3+igiemjI467QgRhwM+crqwO9r6U=";
        };
      }))

      flash-nvim
      gitsigns-nvim
      indent-blankline-nvim
      lualine-nvim
      neo-tree-nvim
      nvim-web-devicons
      mini-nvim

      # completion
      nvim-cmp
      cmp-nvim-lsp
      cmp-buffer
      cmp_luasnip
      cmp-async-path
      luasnip

      # ui
      dressing-nvim
      noice-nvim
      nui-nvim
      nvim-notify

      # lsp
      nvim-lspconfig
      null-ls-nvim

      # utils
      bufferline-nvim
      plenary-nvim
      telescope-nvim
      trouble-nvim
      which-key-nvim

      # treesitter
      (nvim-treesitter.withPlugins (
        _: nvim-treesitter.allGrammars ++ [self'.packages.tree-sitter-just]
      ))
      nvim-ts-context-commentstring
      inputs'.getchoo.packages.vim-just

      # main config
      self'.packages.getchvim
    ];

    extraPrograms = with pkgs; [
      # external tools
      fd
      git
      ripgrep
      just

      # lint
      actionlint
      codespell
      deadnix
      nodePackages.alex
      shellcheck
      statix

      # format
      alejandra
      beautysh
      stylua

      # lsp
      nil
      sumneko-lua-language-server
    ];

    customRC = ''
      lua require("getchoo")
    '';

    config = pkgs.neovimUtils.makeNeovimConfig {
      withPython3 = true;
      withRuby = false;
      inherit plugins;
      inherit customRC;
    };
  in {
    packages = {
      default = self'.packages.neovim;

      neovim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
        config
        // {
          wrapperArgs =
            (lib.escapeShellArgs config.wrapperArgs)
            + " "
            + ''--suffix PATH : "${lib.makeBinPath extraPrograms}"'';
        }
      );

      getchvim = pkgs.vimUtils.buildVimPlugin {
        pname = "getchvim";
        version = builtins.substring 0 8 self.lastModifiedDate or "dirty";

        src = lib.cleanSource ./.;
      };

      tree-sitter-just = pkgs.tree-sitter.buildGrammar {
        language = "just";
        version = "unstable-2023-03-18";
        src = pkgs.fetchFromGitHub {
          owner = "IndianBoy42";
          repo = "tree-sitter-just";
          rev = "4e5f5f3ff37b12a1bbf664eb3966b3019e924594";
          hash = "sha256-Qs0Klt9uj6Vgs4vJrjKXYD8nNe8KYdWCnADvogm4/l0=";
        };
      };
    };
  };
}