style: Formatting

This commit is contained in:
punkfairie 2024-11-28 21:14:59 -08:00
parent 5484ba1eb8
commit c1f894e0f3
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 39 additions and 29 deletions

View file

@ -41,6 +41,7 @@
overlays = [ overlays = [
# Import the overlay, so that the final Neovim derivation(s) can be accessed via pkgs.<nvim-pkg> # Import the overlay, so that the final Neovim derivation(s) can be accessed via pkgs.<nvim-pkg>
neovim-overlay neovim-overlay
# This adds a function can be used to generate a .luarc.json # This adds a function can be used to generate a .luarc.json
# containing the Neovim API all plugins in the workspace directory. # containing the Neovim API all plugins in the workspace directory.
# The generated file can be symlinked in the devShell's shellHook. # The generated file can be symlinked in the devShell's shellHook.

View file

@ -3,6 +3,7 @@
pkgs, pkgs,
lib, lib,
stdenv, stdenv,
#
# Set by the overlay to ensure we use a compatible version of `wrapNeovimUnstable` # Set by the overlay to ensure we use a compatible version of `wrapNeovimUnstable`
pkgs-wrapNeovim ? pkgs, pkgs-wrapNeovim ? pkgs,
}: }:
@ -11,55 +12,59 @@ with lib;
# NVIM_APPNAME - Defaults to 'nvim' if not set. # NVIM_APPNAME - Defaults to 'nvim' if not set.
# If set to something else, this will also rename the binary. # If set to something else, this will also rename the binary.
appName ? null, appName ? null,
#
# The Neovim package to wrap # The Neovim package to wrap
neovim-unwrapped ? pkgs-wrapNeovim.neovim-unwrapped, 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 # List of dev plugins (will be bootstrapped) - useful for plugin developers
# { name = <plugin-name>; url = <git-url>; } # { name = <plugin-name>; url = <git-url>; }
devPlugins ? [], devPlugins ? [],
#
# Regexes for config files to ignore, relative to the nvim directory. # Regexes for config files to ignore, relative to the nvim directory.
# e.g. [ "^plugin/neogit.lua" "^ftplugin/.*.lua" ] # e.g. [ "^plugin/neogit.lua" "^ftplugin/.*.lua" ]
ignoreConfigRegexes ? [], 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 # The below arguments can typically be left as their defaults
#
# Additional lua packages (not plugins), e.g. from luarocks.org. # Additional lua packages (not plugins), e.g. from luarocks.org.
# e.g. p: [p.jsregexp] # e.g. p: [p.jsregexp]
extraLuaPackages ? p: [], extraLuaPackages ? p: [],
extraPython3Packages ? p: [], # Additional python 3 packages #
# Additional python 3 packages
extraPython3Packages ? p: [],
#
withPython3 ? true, # Build Neovim with Python 3 support? withPython3 ? true, # Build Neovim with Python 3 support?
withRuby ? false, # Build Neovim with Ruby support? withRuby ? false, # Build Neovim with Ruby support?
withNodeJs ? false, # Build Neovim with NodeJS support? withNodeJs ? false, # Build Neovim with NodeJS support?
withSqlite ? true, # Add sqlite? This is a dependency for some plugins withSqlite ? true, # Add sqlite? This is a dependency for some plugins
#
# You probably don't want to create vi or vim aliases # You probably don't want to create vi or vim aliases
# if the appName is something different than "nvim" # if the appName is something different than "nvim"
#
# Add a "vi" binary to the build output as an alias? # Add a "vi" binary to the build output as an alias?
viAlias ? appName == null || appName == "nvim", viAlias ? appName == null || appName == "nvim",
#
# Add a "vim" binary to the build output as an alias? # Add a "vim" binary to the build output as an alias?
vimAlias ? appName == null || appName == "nvim", vimAlias ? appName == null || appName == "nvim",
}: let }: 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]); externalPackages = extraPackages ++ (optionals withSqlite [pkgs.sqlite]);
# Map all plugins to an attrset { plugin = <plugin>; config = <config>; optional = <tf>; ... } # Map all plugins to an attrset { plugin = <plugin>; config = <config>; optional = <tf>; ... }
normalizedPlugins = map (x: normalizedPlugins =
defaultPlugin map (
// ( x:
if x ? plugin if x ? plugin
then x then x
else {plugin = x;} else {plugin = x;}
)) )
plugins; plugins;
# This nixpkgs util function creates an attrset # This nixpkgs util function creates an attrset
# that pkgs.wrapNeovimUnstable uses to configure the Neovim build. # that pkgs.wrapNeovimUnstable uses to configure the Neovim build.

View file

@ -4,11 +4,11 @@ with final.pkgs.lib; let
pkgs = final; pkgs = final;
# Use this to create a plugin from a flake input # Use this to create a plugin from a flake input
mkNvimPlugin = src: pname: # mkNvimPlugin = src: pname:
pkgs.vimUtils.buildVimPlugin { # pkgs.vimUtils.buildVimPlugin {
inherit pname src; # inherit pname src;
version = src.lastModifiedDate; # version = src.lastModifiedDate;
}; # };
# Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable, # Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable,
# otherwise it could have an incompatible signature when applying this overlay. # 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; [ all-plugins = with pkgs.vimPlugins; [
# bleeding-edge plugins from flake inputs # bleeding-edge plugins from flake inputs
# (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints # (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints
# Base
lz-n lz-n
snacks-nvim snacks-nvim
]; ];
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# System packages
ripgrep ripgrep
lazygit lazygit
# language servers
# Language servers
lua-language-server lua-language-server
nixd nixd
]; ];