robin/weave

simple neovim wrapper for nix

git clone https://git.robinwobin.dev/robin/weave

robindoc: plugin supporta86f32a

main
3.4 KiB109 linesraw

weave

Weave is a simple neovim wrapper for nix that allows you to maintain your neovim configuration with lua and with nix for package management.

Weave is meant be a very minimal neovim wrapper, but i can still be pretty opiniated at times.

Weave is based on gift-wrap

Usage

{
  inputs = {
    nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";

    weave = {
      url = "git+https://codeberg.org/comfysage/weave";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, weave }:
    let
      inherit (nixpkgs) lib;

      forAllSystems =
        f: lib.genAttrs lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system});
    in
    {
      packages = forAllSystems (pkgs: {
        nvim = weave.legacyPackages.${pkgs.system}.wrapNeovim {
          # what is the name of your neovim config?
          pname = "my-neovim";

          # perhaps add a version suffix to your package
          # this is a sensible default
          versionSuffix = self.shortRev or self.dirtyShortRev or "unknown";

          # this is the base package for your neovim configuration
          # this defaults to neovim-unwrapped and most of the time you will not need to change this
          basePackage = pkgs.neovim-unwrapped;

          # this field allows you to create aliases to the neovim executable
          # this defaults to blank, the bellow example will create the aliases `vi` and `vim`
          aliases = [ "vi" "vim" ];

          # wether to keep the desktop files for neovim
          # by default this is set to false, but you can set it to true
          keepDesktopFiles = true;

          # your user conifguration, this should be a path your nvim config in lua
          userConfig = ./config;

          # use npins to manage your plugins
          plugins = import ./npins {};

          # override npins sources
          pluginOverrides = {
            lynn = { passthru.start = true; };
          };

          # all the plugins that should be stored in the neovim start directory
          # these are the plugins that are loaded when neovim starts
          startPlugins = with pkgs.vimPlugins; [
            nvim-treesitter.withAllGrammars
            nvim-lspconfig
          ];

          # these are plugins that are loaded on demand by your configuration
          optPlugins = with pkgs.vimPlugins; [
            blink-cmp
            telescope
            lazygit-nvim
          ];

          # these are any extra packages that should be available in your neovim environment
          extraPackages = with pkgs; [
            ripgrep
            fd
            inotify-tools
            lazygit
          ];

          # below is a list of plugin providers, these should then be
          # configured in your plugin or setup properly by adding to your path
          # or the extraInitLua
          #
          # this can also be a list of strings
          providers = {
            node = false;
            python = false;
            python3 = true;
            ruby = false;
            perl = false;
          };

          # following the providers above, you can set the exact package for
          # your providers, in this case python3
          extraInitLua = ''
            vim.g.python3_host_prog = '${lib.getExe pkgs.python3}'
          '';
        };
      });
    };
}
1## weave
2
3Weave is a simple neovim wrapper for nix that allows you to maintain your
4neovim configuration with lua and with nix for package management.
5
6Weave is meant be a very minimal neovim wrapper, but i can still be pretty opiniated at times.
7
8Weave is based on [gift-wrap]
9
10[gift-wrap]: https://github.com/tgirlcloud/gift-wrap
11
12### Usage
13
14```nix
15{
16  inputs = {
17    nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
18
19    weave = {
20      url = "git+https://codeberg.org/comfysage/weave";
21      inputs.nixpkgs.follows = "nixpkgs";
22    };
23  };
24
25  outputs = { self, nixpkgs, weave }:
26    let
27      inherit (nixpkgs) lib;
28
29      forAllSystems =
30        f: lib.genAttrs lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system});
31    in
32    {
33      packages = forAllSystems (pkgs: {
34        nvim = weave.legacyPackages.${pkgs.system}.wrapNeovim {
35          # what is the name of your neovim config?
36          pname = "my-neovim";
37
38          # perhaps add a version suffix to your package
39          # this is a sensible default
40          versionSuffix = self.shortRev or self.dirtyShortRev or "unknown";
41
42          # this is the base package for your neovim configuration
43          # this defaults to neovim-unwrapped and most of the time you will not need to change this
44          basePackage = pkgs.neovim-unwrapped;
45
46          # this field allows you to create aliases to the neovim executable
47          # this defaults to blank, the bellow example will create the aliases `vi` and `vim`
48          aliases = [ "vi" "vim" ];
49
50          # wether to keep the desktop files for neovim
51          # by default this is set to false, but you can set it to true
52          keepDesktopFiles = true;
53
54          # your user conifguration, this should be a path your nvim config in lua
55          userConfig = ./config;
56
57          # use npins to manage your plugins
58          plugins = import ./npins {};
59
60          # override npins sources
61          pluginOverrides = {
62            lynn = { passthru.start = true; };
63          };
64
65          # all the plugins that should be stored in the neovim start directory
66          # these are the plugins that are loaded when neovim starts
67          startPlugins = with pkgs.vimPlugins; [
68            nvim-treesitter.withAllGrammars
69            nvim-lspconfig
70          ];
71
72          # these are plugins that are loaded on demand by your configuration
73          optPlugins = with pkgs.vimPlugins; [
74            blink-cmp
75            telescope
76            lazygit-nvim
77          ];
78
79          # these are any extra packages that should be available in your neovim environment
80          extraPackages = with pkgs; [
81            ripgrep
82            fd
83            inotify-tools
84            lazygit
85          ];
86
87          # below is a list of plugin providers, these should then be
88          # configured in your plugin or setup properly by adding to your path
89          # or the extraInitLua
90          #
91          # this can also be a list of strings
92          providers = {
93            node = false;
94            python = false;
95            python3 = true;
96            ruby = false;
97            perl = false;
98          };
99
100          # following the providers above, you can set the exact package for
101          # your providers, in this case python3
102          extraInitLua = ''
103            vim.g.python3_host_prog = '${lib.getExe pkgs.python3}'
104          '';
105        };
106      });
107    };
108}
109```