mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge branch 'main' into add-nixd-opts
This commit is contained in:
commit
6d7b8ec2f1
60 changed files with 2915 additions and 4046 deletions
|
@ -3,7 +3,7 @@
|
|||
```{=include=} chapters
|
||||
configuring/custom-package.md
|
||||
configuring/custom-plugins.md
|
||||
configuring/custom-inputs.md
|
||||
configuring/overriding-plugins.md
|
||||
configuring/languages.md
|
||||
configuring/dags.md
|
||||
configuring/dag-entries.md
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
# Custom Inputs {#ch-custom-inputs}
|
||||
|
||||
One of the greatest strengths of **nvf** is its ability to get plugins from
|
||||
flake inputs and build them locally from any given source. For plugins that do
|
||||
not require any kind of additional building step, this is a powerful method of
|
||||
adding plugins to your configuration that are not packaged in nixpkgs, or those
|
||||
you want to track from source without relying on nixpkgs.
|
||||
|
||||
The [additional plugins section](#sec-additional-plugins) details the addition
|
||||
of new plugins to nvf under regular circumstances, i.e. while making a pull
|
||||
request to the project. You may _override_ those plugin inputs in your own
|
||||
`flake.nix` to change source versions, e.g., to use newer versions of plugins
|
||||
that are not yet updated in **nvf**.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
||||
inputs = {
|
||||
# ...
|
||||
|
||||
# The name here is arbitrary, you can name it whatever.
|
||||
# This will add a plugin input called "your-neodev-input"
|
||||
# that you can reference in a `follows` line.
|
||||
your-neodev-input = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
|
||||
# The name of the input must match for the follows line
|
||||
# plugin-neodev-nvim is what the input is called inside nvf
|
||||
# so you must match the exact name here.
|
||||
inputs.plugin-neodev-nvim.follows = "your-neodev-input";
|
||||
};
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This will override the source for the `neodev.nvim` plugin that is used in nvf
|
||||
with your own input. You can update your new input via `nix flake update` or
|
||||
more specifically `nix flake update <name of your input>` to keep it up to date.
|
||||
|
||||
::: {.warning}
|
||||
|
||||
While updating plugin inputs, make sure that any configuration that has been
|
||||
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
|
||||
depend on a new version, requesting a version bump in the issues section is a
|
||||
more reliable option.
|
||||
|
||||
:::
|
35
docs/manual/configuring/overriding-plugins.md
Normal file
35
docs/manual/configuring/overriding-plugins.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Overriding plugins {#ch-overriding-plugins}
|
||||
|
||||
The [additional plugins section](#sec-additional-plugins) details the addition
|
||||
of new plugins to nvf under regular circumstances, i.e. while making a pull
|
||||
request to the project. You may _override_ those plugins in your config
|
||||
to change source versions, e.g., to use newer versions of plugins
|
||||
that are not yet updated in **nvf**.
|
||||
|
||||
```nix
|
||||
vim.pluginOverrides = {
|
||||
lazydev-nvim = pkgs.fetchFromGitHub {
|
||||
owner = "folke";
|
||||
repo = "lazydev.nvim";
|
||||
rev = "";
|
||||
hash = "";
|
||||
};
|
||||
# It's also possible to use a flake input
|
||||
lazydev-nvim = inputs.lazydev-nvim;
|
||||
# Or a local path
|
||||
lazydev-nvim = ./lazydev;
|
||||
# Or a npins pin... etc
|
||||
};
|
||||
```
|
||||
|
||||
This will override the source for the `neodev.nvim` plugin that is used in nvf
|
||||
with your own plugin.
|
||||
|
||||
::: {.warning}
|
||||
|
||||
While updating plugin inputs, make sure that any configuration that has been
|
||||
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
|
||||
depend on a new version, requesting a version bump in the issues section is a
|
||||
more reliable option.
|
||||
|
||||
:::
|
|
@ -1,36 +1,25 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
To add a new Neovim plugin, first add the source url in the inputs section of
|
||||
`flake.nix` with the prefix `plugin-`
|
||||
To add a new Neovim plugin, use `npins`
|
||||
|
||||
Use:
|
||||
|
||||
`nix-shell -p npins` or `nix shell nixpkgs#npins`
|
||||
|
||||
Then run:
|
||||
|
||||
`npins add --name <plugin name> github <owner> <repo> -b <branch>`
|
||||
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`
|
||||
|
||||
For example
|
||||
|
||||
`npins add --name lazydev-nvim github folke lazydev.nvim -b main`
|
||||
|
||||
You can now reference this plugin as a **string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
# ...
|
||||
plugin-neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Prepending `plugin-` to the name of the input will allow nvf to automatically
|
||||
discover inputs that are marked as plugins, and make them available in
|
||||
`vim.startPlugins` or other areas that require a very specific plugin type as it
|
||||
is defined in `@NVF_REPO@/lib/types/plugins.nix`
|
||||
|
||||
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
|
||||
input from the flake inputs automatically, allowing you to refer to it in areas
|
||||
that require a very specific plugin type as defined in `lib/types/plugins.nix`
|
||||
|
||||
You can now reference this plugin using its string name, the plugin will be
|
||||
built with the name and source URL from the flake input, allowing you to refer
|
||||
to it as a **string**.
|
||||
|
||||
```nix
|
||||
config.vim.startPlugins = ["neodev-nvim"];
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
```
|
||||
|
||||
## Modular setup options {#sec-modular-setup-options}
|
||||
|
|
|
@ -23,15 +23,17 @@ An example flake that exposes your custom Neovim configuration might look like
|
|||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: {
|
||||
packages."x86_64-linux" = let
|
||||
neovimConfigured = (inputs.nvf.lib.neovimConfiguration {
|
||||
inherit (nixpkgs.legacyPackages."x86_64-linux") pkgs;
|
||||
modules = [{
|
||||
outputs = {nixpkgs, ...} @ inputs: {
|
||||
packages.x86_64-linux = {
|
||||
# Set the default package to the wrapped instance of Neovim.
|
||||
# This will allow running your Neovim configuration with
|
||||
# `nix run` and in addition, sharing your configuration with
|
||||
# other users in case your repository is public.
|
||||
default =
|
||||
(inputs.nvf.lib.neovimConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = [
|
||||
{
|
||||
config.vim = {
|
||||
# Enable custom theming options
|
||||
theme.enable = true;
|
||||
|
@ -43,14 +45,10 @@ An example flake that exposes your custom Neovim configuration might look like
|
|||
# reference in Appendix B of the nvf manual.
|
||||
# ...
|
||||
};
|
||||
}];
|
||||
});
|
||||
in {
|
||||
# Set the default package to the wrapped instance of Neovim.
|
||||
# This will allow running your Neovim configuration with
|
||||
# `nix run` and in addition, sharing your configuration with
|
||||
# other users in case your repository is public.
|
||||
default = neovimConfigured.neovim;
|
||||
}
|
||||
];
|
||||
})
|
||||
.neovim;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -49,13 +49,10 @@ Followed by importing the home-manager module somewhere in your configuration.
|
|||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, nvf, ... }: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
outputs = { nixpkgs, home-manager, nvf, ... }: {
|
||||
# ↓ this is your home output in the flake schema, expected by home-manager
|
||||
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = [
|
||||
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
||||
./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here
|
||||
|
|
|
@ -16,26 +16,32 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, nvf, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
configModule = {
|
||||
# Add any custom options (and do feel free to upstream them!)
|
||||
# options = { ... };
|
||||
|
||||
config.vim = {
|
||||
theme.enable = true;
|
||||
# and more options as you see fit...
|
||||
};
|
||||
};
|
||||
|
||||
customNeovim = nvf.lib.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [configModule];
|
||||
};
|
||||
in {
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
nvf,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
# This will make the package available as a flake output under 'packages'
|
||||
packages.${system}.my-neovim = customNeovim.neovim;
|
||||
packages.x86_64-linux.my-neovim =
|
||||
(nvf.lib.neovimConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = [
|
||||
# Or move this to a separate file and add it's path here instead
|
||||
# IE: ./nvf_module.nix
|
||||
(
|
||||
{pkgs, ...}: {
|
||||
# Add any custom options (and do feel free to upstream them!)
|
||||
# options = { ... };
|
||||
config.vim = {
|
||||
theme.enable = true;
|
||||
# and more options as you see fit...
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
.neovim;
|
||||
|
||||
# Example nixosConfiguration using the configured Neovim package
|
||||
nixosConfigurations = {
|
||||
|
@ -43,11 +49,13 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
# ...
|
||||
modules = [
|
||||
# This will make wrapped neovim available in your system packages
|
||||
{environment.systemPackages = [customNeovim.neovim];}
|
||||
# Can also move this to another config file if you pass inputs/self around with specialArgs
|
||||
({pkgs, ...}: {
|
||||
environment.systemPackages = [self.packages.${pkgs.stdenv.system}.neovim];
|
||||
})
|
||||
];
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
}```
|
||||
|
|
|
@ -47,6 +47,12 @@
|
|||
|
||||
- Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim].
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||
|
||||
- Add [blink.cmp] support
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
- Add Odin support under `vim.languages.odin`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue