diff --git a/flake.nix b/flake.nix index 25823e5..5fdaf19 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ overlays = [ # Import the overlay, so that the final Neovim derivation(s) can be accessed via pkgs. neovim-overlay + # This adds a function can be used to generate a .luarc.json # containing the Neovim API all plugins in the workspace directory. # The generated file can be symlinked in the devShell's shellHook. diff --git a/nix/mkNeovim.nix b/nix/mkNeovim.nix index eaa474a..cf03df6 100644 --- a/nix/mkNeovim.nix +++ b/nix/mkNeovim.nix @@ -3,6 +3,7 @@ pkgs, lib, stdenv, + # # Set by the overlay to ensure we use a compatible version of `wrapNeovimUnstable` pkgs-wrapNeovim ? pkgs, }: @@ -11,55 +12,59 @@ with lib; # NVIM_APPNAME - Defaults to 'nvim' if not set. # If set to something else, this will also rename the binary. appName ? null, + # # The Neovim package to wrap neovim-unwrapped ? pkgs-wrapNeovim.neovim-unwrapped, - plugins ? [], # List of plugins + # + # List of plugins + plugins ? [], + # # List of dev plugins (will be bootstrapped) - useful for plugin developers # { name = ; url = ; } devPlugins ? [], + # # Regexes for config files to ignore, relative to the nvim directory. # e.g. [ "^plugin/neogit.lua" "^ftplugin/.*.lua" ] ignoreConfigRegexes ? [], - extraPackages ? [], # Extra runtime dependencies (e.g. ripgrep, ...) + # + # Extra runtime dependencies (e.g. ripgrep, ...) + extraPackages ? [], + # + # # The below arguments can typically be left as their defaults + # # Additional lua packages (not plugins), e.g. from luarocks.org. # e.g. p: [p.jsregexp] extraLuaPackages ? p: [], - extraPython3Packages ? p: [], # Additional python 3 packages + # + # Additional python 3 packages + extraPython3Packages ? p: [], + # withPython3 ? true, # Build Neovim with Python 3 support? withRuby ? false, # Build Neovim with Ruby support? withNodeJs ? false, # Build Neovim with NodeJS support? withSqlite ? true, # Add sqlite? This is a dependency for some plugins + # # You probably don't want to create vi or vim aliases # if the appName is something different than "nvim" + # # Add a "vi" binary to the build output as an alias? viAlias ? appName == null || appName == "nvim", + # # Add a "vim" binary to the build output as an alias? vimAlias ? appName == null || appName == "nvim", }: let - # This is the structure of a plugin definition. - # Each plugin in the `plugins` argument list can also be defined as this attrset - defaultPlugin = { - plugin = null; # e.g. nvim-lspconfig - config = null; # plugin config - # If `optional` is set to `false`, the plugin is installed in the 'start' packpath - # set to `true`, it is installed in the 'opt' packpath, and can be lazy loaded with - # ':packadd! {plugin-name} - optional = false; - runtime = {}; - }; - externalPackages = extraPackages ++ (optionals withSqlite [pkgs.sqlite]); # Map all plugins to an attrset { plugin = ; config = ; optional = ; ... } - normalizedPlugins = map (x: - defaultPlugin - // ( - if x ? plugin - then x - else {plugin = x;} - )) - plugins; + normalizedPlugins = + map ( + x: + if x ? plugin + then x + else {plugin = x;} + ) + plugins; # This nixpkgs util function creates an attrset # that pkgs.wrapNeovimUnstable uses to configure the Neovim build. diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index fe9b999..1da5a54 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -4,11 +4,11 @@ with final.pkgs.lib; let pkgs = final; # Use this to create a plugin from a flake input - mkNvimPlugin = src: pname: - pkgs.vimUtils.buildVimPlugin { - inherit pname src; - version = src.lastModifiedDate; - }; + # mkNvimPlugin = src: pname: + # pkgs.vimUtils.buildVimPlugin { + # inherit pname src; + # version = src.lastModifiedDate; + # }; # Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable, # otherwise it could have an incompatible signature when applying this overlay. @@ -28,14 +28,18 @@ with final.pkgs.lib; let all-plugins = with pkgs.vimPlugins; [ # bleeding-edge plugins from flake inputs # (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints + + # Base lz-n snacks-nvim ]; extraPackages = with pkgs; [ + # System packages ripgrep lazygit - # language servers + + # Language servers lua-language-server nixd ];