~whynothugo/dotfiles

dotfiles/v/flake.nix -rw-r--r-- 4.0 KiB
036d12dbHugo Osvaldo Barrera geoclue-agent: Run as a dependency for darkman 3 days ago
                                                                                
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
{
  description = "Hugo's neovim setup";

  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          pkgs = import nixpkgs { inherit system; };

          # Nix is too slow to update
          lsp_lines-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
            pname = "lsp_lines.nvim";
            version = "2022-07-23";
            src = pkgs.fetchgit {
              url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim";
              rev = "3b57922d2d79762e6baedaf9d66d8ba71f822816";
              sha256 = "12shzpqmamaavg8xghvix09jzsinaa76w4bpda9zp3sycfrwrwfn";
            };
            meta.homepage = "https://git.sr.ht/~whynothugo/lsp_lines.nvim";
          };

          # The following will all be added to $PATH
          paths = pkgs.lib.makeBinPath [
            # neovim itself:
            pkgs.neovim

            # Language servers (ran by neovim):
            pkgs.clang
            pkgs.docker-ls
            pkgs.gopls
            pkgs.nodePackages.bash-language-server
            pkgs.nodePackages.dockerfile-language-server-nodejs
            pkgs.nodePackages.typescript-language-server
            pkgs.nodePackages.yaml-language-server
            pkgs.python310Packages.jedi-language-server
            pkgs.rnix-lsp
            pkgs.rust-analyzer
            pkgs.sumneko-lua-language-server
            pkgs.terraform-ls
            # MISSING: volar

            # Support packages:
            pkgs.shellcheck # Required by bash-language-server
          ];

          # List of plugins
          pluginList = with pkgs.vimPlugins; [
            # Completion
            nvim-cmp
            cmp-buffer
            cmp-emoji
            cmp-nvim-lsp
            cmp-nvim-lua
            cmp-path
            cmp-spell
            cmp-treesitter

            # LSP
            lsp-status-nvim
            lsp_lines-nvim
            lspcontainers-nvim
            null-ls-nvim
            nvim-lightbulb
            nvim-lspconfig

            # Others
            spellsitter-nvim
            ag-nvim
            editorconfig-vim
            fzf-lua
            lualine-nvim
            gitsigns-nvim
            indent-blankline-nvim
            markdown-preview-nvim
            nvim-colorizer-lua
            nvim-luapad

            # Tree sitter with all grammars:
            (pkgs.vimPlugins.nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
            nvim-treesitter-textobjects
            playground
            plenary-nvim
            # XXX: Try instead: tree-sitter-grammars.tree-sitter-scss:
            scss-syntax-vim
            sphinx-nvim
            swift-vim
            symbols-outline-nvim
            tcomment_vim
            tokyonight-nvim
            trouble-nvim
            vim-devicons
            vim-hcl
            vim-lastplace
            vim-sensible
            vim-smoothie
            swayconfig-vim

            which-key-nvim
          ];

          # Build a derivation which contains all plugins.
          # This path is later added to $XDG_DATA_DIRS so neovim loads them all.
          plugins = with pkgs.vimPlugins; (
            pkgs.stdenv.mkDerivation
              {
                name = "hugos-neovim-plugins";
                buildCommand = ''
                  mkdir -p $out/nvim/site/pack/plugins/start/
                  ${pkgs.lib.concatMapStringsSep "\n" (path: "ln -s ${path} $out/nvim/site/pack/plugins/start/")  pluginList }
                '';
              }
          );
        in
        {
          # The default package exposed by this flake is just a tiny
          # wrapper around neovim:
          # TODO: drop this shell wrapper and do a real package, which includes
          # man and other stuff.
          defaultPackage = pkgs.writeShellScriptBin "v" ''
            export PATH=${paths}:$PATH
            export XDG_DATA_DIRS=${plugins.outPath}:$XDG_DATA_DIRS
            nvim "$@"
          '';
        }
      );
}