Compare commits
2 commits
5484ba1eb8
...
123dfb81f9
Author | SHA1 | Date | |
---|---|---|---|
123dfb81f9 | |||
c1f894e0f3 |
4 changed files with 47 additions and 35 deletions
|
@ -41,6 +41,7 @@
|
|||
overlays = [
|
||||
# Import the overlay, so that the final Neovim derivation(s) can be accessed via pkgs.<nvim-pkg>
|
||||
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.
|
||||
|
|
|
@ -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 = <plugin-name>; url = <git-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 = <plugin>; config = <config>; optional = <tf>; ... }
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
];
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
# https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/util.lua
|
||||
-- https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/util.lua
|
||||
|
||||
---@class lib.lazy.util
|
||||
local M = {}
|
||||
|
||||
---@return string
|
||||
function M.norm(path)
|
||||
if path:sub(1, 1) == "~" then
|
||||
local home = vim.uv.os_homedir() or ""
|
||||
if path:sub(1, 1) == '~' then
|
||||
local home = vim.uv.os_homedir() or ''
|
||||
|
||||
if home:sub(-1) == "\\" or home:sub(-1) == '/' then
|
||||
if home:sub(-1) == '\\' or home:sub(-1) == '/' then
|
||||
home = home:sub(1, -2)
|
||||
end
|
||||
|
||||
path = home .. path:sub(2)
|
||||
end
|
||||
|
||||
path = path:gsub("\\", "/"):gsub("/+", "/")
|
||||
path = path:gsub('\\', '/'):gsub('/+', '/')
|
||||
|
||||
return path:sub(-1) == "/" and path:sub(1, -2) or path
|
||||
return path:sub(-1) == '/' and path:sub(1, -2) or path
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in a new issue