mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge remote-tracking branch 'origin/main' into v0.8
This commit is contained in:
commit
e1ad7f4fb9
49 changed files with 1338 additions and 727 deletions
|
@ -14,14 +14,17 @@ explains in more detail the overall usage logic of the DAG type.
|
|||
|
||||
## entryAnywhere {#sec-types-dag-entryAnywhere}
|
||||
|
||||
> `lib.dag.entryAnywhere (value: T) : DagEntry<T>`
|
||||
> `nvf.lib.nvim.dag.entryAnywhere (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` can be placed anywhere within the DAG. This is also the
|
||||
default for plain attribute set entries, that is
|
||||
|
||||
```nix
|
||||
# For 'nvf' to be available in module's arguments,
|
||||
# it needs to be inherited from imports in the modules array as:
|
||||
# modules = [{ _module.args = { inherit nvf; }; } ...];
|
||||
foo.bar = {
|
||||
a = lib.dag.entryAnywhere 0;
|
||||
a = nvf.lib.nvim.dag.entryAnywhere 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -37,7 +40,7 @@ are equivalent.
|
|||
|
||||
## entryAfter {#ch-types-dag-entryAfter}
|
||||
|
||||
> `lib.dag.entryAfter (afters: list string) (value: T) : DagEntry<T>`
|
||||
> `nvf.lib.nvim.dag.entryAfter (afters: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _after_ each of the attribute names in the
|
||||
given list. For example
|
||||
|
@ -45,7 +48,7 @@ given list. For example
|
|||
```nix
|
||||
foo.bar = {
|
||||
a = 0;
|
||||
b = lib.dag.entryAfter [ "a" ] 1;
|
||||
b = nvf.lib.nvim.dag.entryAfter [ "a" ] 1;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -53,14 +56,14 @@ would place `b` after `a` in the graph.
|
|||
|
||||
## entryBefore {#ch-types-dag-entryBefore}
|
||||
|
||||
> `lib.dag.entryBefore (befores: list string) (value: T) : DagEntry<T>`
|
||||
> `nvf.lib.nvim.dag.entryBefore (befores: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _before_ each of the attribute names in
|
||||
the given list. For example
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
b = lib.dag.entryBefore [ "a" ] 1;
|
||||
b = nvf.lib.nvim.dag.entryBefore [ "a" ] 1;
|
||||
a = 0;
|
||||
}
|
||||
```
|
||||
|
@ -69,7 +72,7 @@ would place `b` before `a` in the graph.
|
|||
|
||||
## entryBetween {#sec-types-dag-entryBetween}
|
||||
|
||||
> `lib.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T>`
|
||||
> `nvf.lib.nvim.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _before_ the attribute names in the first
|
||||
list and _after_ the attribute names in the second list. For example
|
||||
|
@ -77,7 +80,7 @@ list and _after_ the attribute names in the second list. For example
|
|||
```nix
|
||||
foo.bar = {
|
||||
a = 0;
|
||||
c = lib.dag.entryBetween [ "b" ] [ "a" ] 2;
|
||||
c = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a" ] 2;
|
||||
b = 1;
|
||||
}
|
||||
```
|
||||
|
@ -92,13 +95,13 @@ functions take a `tag` as argument and the DAG entries will be named
|
|||
|
||||
## entriesAnywhere {#sec-types-dag-entriesAnywhere}
|
||||
|
||||
> `lib.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T>`
|
||||
> `nvf.lib.nvim.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
For example
|
||||
|
||||
```nix
|
||||
foo.bar = lib.dag.entriesAnywhere "a" [ 0 1 ];
|
||||
foo.bar = nvf.lib.nvim.dag.entriesAnywhere "a" [ 0 1 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
@ -106,13 +109,13 @@ is equivalent to
|
|||
```nix
|
||||
foo.bar = {
|
||||
a-0 = 0;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryAfter [ "a-0" ] 1;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesAfter {#sec-types-dag-entriesAfter}
|
||||
|
||||
> `lib.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
> `nvf.lib.nvim.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed are placed _after_ each of the attribute names in
|
||||
|
@ -120,7 +123,7 @@ The list of values are placed are placed _after_ each of the attribute names in
|
|||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesAfter "a" [ "b" ] [ 1 2 ];
|
||||
{ b = 0; } // nvf.lib.nvim.dag.entriesAfter "a" [ "b" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
@ -128,14 +131,14 @@ is equivalent to
|
|||
```nix
|
||||
foo.bar = {
|
||||
b = 0;
|
||||
a-0 = lib.dag.entryAfter [ "b" ] 1;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 2;
|
||||
a-0 = nvf.lib.nvim.dag.entryAfter [ "b" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryAfter [ "a-0" ] 2;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesBefore {#sec-types-dag-entriesBefore}
|
||||
|
||||
> `lib.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T>`
|
||||
> `nvf.lib.nvim.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed _before_ each of the attribute names in `befores`.
|
||||
|
@ -143,7 +146,7 @@ For example
|
|||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesBefore "a" [ "b" ] [ 1 2 ];
|
||||
{ b = 0; } // nvf.lib.nvim.dag.entriesBefore "a" [ "b" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
@ -152,13 +155,13 @@ is equivalent to
|
|||
foo.bar = {
|
||||
b = 0;
|
||||
a-0 = 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
a-1 = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesBetween {#sec-types-dag-entriesBetween}
|
||||
|
||||
> `lib.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
> `nvf.lib.nvim.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed _before_ each of the attribute names in `befores`
|
||||
|
@ -166,7 +169,7 @@ and _after_ each of the attribute names in `afters`. For example
|
|||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; c = 3; } // lib.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];
|
||||
{ b = 0; c = 3; } // nvf.lib.nvim.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
@ -175,7 +178,7 @@ is equivalent to
|
|||
foo.bar = {
|
||||
b = 0;
|
||||
c = 3;
|
||||
a-0 = lib.dag.entryAfter [ "c" ] 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
a-0 = nvf.lib.nvim.dag.entryAfter [ "c" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
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**.
|
||||
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 = {
|
||||
|
|
|
@ -1,25 +1,92 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
To add a new Neovim plugin, use `npins`
|
||||
There are two methods for adding new Neovim plugins to **nvf**. npins is the
|
||||
faster option that should be preferred if the plugin consists of pure Lua or
|
||||
Vimscript code. In which case there is no building required, and we can easily
|
||||
handle the copying of plugin files. Alternative method, which is required when
|
||||
plugins try to build their own libraries (e.g., in Rust or C) that need to be
|
||||
built with Nix to function correctly.
|
||||
|
||||
Use:
|
||||
## With npins {#sec-npins-for-plugins}
|
||||
|
||||
`nix-shell -p npins` or `nix shell nixpkgs#npins`
|
||||
npins is the standard method of adding new plugins to **nvf**. You simply need
|
||||
the repository URL for the plugin, and can add it as a source to be built
|
||||
automatically with one command. To add a new Neovim plugin, use `npins`. For
|
||||
example:
|
||||
|
||||
```bash
|
||||
nix-shell -p npins # or nix shell nixpkgs#npins if using flakes
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
`npins add --name <plugin name> github <owner> <repo> -b <branch>`
|
||||
```bash
|
||||
npins add --name <plugin name> github <owner> <repo> -b <branch>
|
||||
```
|
||||
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`
|
||||
::: {.note}
|
||||
|
||||
For example
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`. For
|
||||
example
|
||||
|
||||
`npins add --name lazydev-nvim github folke lazydev.nvim -b main`
|
||||
```bash
|
||||
npins add --name lazydev-nvim github folke lazydev.nvim -b main
|
||||
```
|
||||
|
||||
You can now reference this plugin as a **string**.
|
||||
:::
|
||||
|
||||
Once the `npins` command is done, you can start referencing the plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
{
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
}
|
||||
```
|
||||
|
||||
## Packaging Complex Plugins {#sec-pkgs-for-plugins}
|
||||
|
||||
[blink.cmp]: https://github.com/Saghen/blink.cmp
|
||||
|
||||
Some plugins require additional packages to be built and substituted to function
|
||||
correctly. For example [blink.cmp] requires its own fuzzy matcher library, built
|
||||
with Rust, to be installed or else defaults to a much slower Lua implementation.
|
||||
In the Blink documentation, you are advised to build with `cargo` but that is
|
||||
not ideal since we are leveraging the power of Nix. In this case the ideal
|
||||
solution is to write a derivation for the plugin.
|
||||
|
||||
We use `buildRustPackage` to build the library from the repository root, and
|
||||
copy everything in the `postInstall` phase.
|
||||
|
||||
```nix
|
||||
postInstall = ''
|
||||
cp -r {lua,plugin} "$out"
|
||||
|
||||
mkdir -p "$out/doc"
|
||||
cp 'doc/'*'.txt' "$out/doc/"
|
||||
|
||||
mkdir -p "$out/target"
|
||||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
```
|
||||
|
||||
In a similar fashion, you may utilize `stdenv.mkDerivation` and other Nixpkgs
|
||||
builders to build your library from source, and copy the relevant files and Lua
|
||||
plugin files in the `postInstall` phase. Do note, however, that you still need
|
||||
to fetch the plugin sources somehow. npins is, once again, the recommended
|
||||
option to fetch the plugin sources. Refer to the previous section on how to use
|
||||
npins to add a new plugin.
|
||||
|
||||
Plugins built from source must go into the `flake/pkgs/by-name` overlay. It will
|
||||
automatically create flake outputs for individual packages. Lastly, you must add
|
||||
your package to the plugin builder (`pluginBuilders`) function manually in
|
||||
`modules/wrapper/build/config.nix`. Once done, you may refer to your plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["blink-cmp"];
|
||||
}
|
||||
```
|
||||
|
||||
## Modular setup options {#sec-modular-setup-options}
|
||||
|
@ -70,7 +137,7 @@ in {
|
|||
}
|
||||
```
|
||||
|
||||
This above config will result in this lua script:
|
||||
This above config will result in this Lua script:
|
||||
|
||||
```lua
|
||||
require('plugin-name').setup({
|
||||
|
@ -101,23 +168,41 @@ own fields!
|
|||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. nix `null` converts to lua `nil`
|
||||
2. number and strings convert to their lua counterparts
|
||||
3. nix attrSet/list convert into lua tables
|
||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs.
|
||||
1. Nix `null` converts to lua `nil`
|
||||
2. Number and strings convert to their lua counterparts
|
||||
3. Nix attribute sets (`{}`) and lists (`[]`) convert into Lua dictionaries and
|
||||
tables respectively. Here is an example of Nix -> Lua conversion.
|
||||
- `{foo = "bar"}` -> `{["foo"] = "bar"}`
|
||||
- `["foo" "bar"]` -> `{"foo", "bar"}`
|
||||
4. You can write raw Lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs, and is accessible without relying on **nvf**'s extended
|
||||
library.
|
||||
- `mkLuaInline "function add(a, b) return a + b end"` will yield the
|
||||
following result:
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
_type = "lua-inline";
|
||||
expr = "function add(a, b) return a + b end";
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
}
|
||||
```
|
||||
The above expression will be interpreted as a Lua expression in the final
|
||||
config. Without the `mkLuaInline` function, you will only receive a string
|
||||
literal. You can use it to feed plugin configuration tables Lua functions
|
||||
that return specific values as expected by the plugins.
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Lazy plugins {#sec-lazy-plugins}
|
||||
|
||||
|
@ -126,25 +211,24 @@ Lazy plugins are managed by `lz.n`.
|
|||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{lib, config, ...}:
|
||||
let
|
||||
{config, ...}: let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.lazy.plugins.your-plugin = {
|
||||
# instead of vim.startPlugins, use this:
|
||||
# Instead of vim.startPlugins, use this:
|
||||
package = "your-plugin";
|
||||
|
||||
# if your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
# ıf your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
setupModule = "your-plugin";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
# events that trigger this plugin to be loaded
|
||||
# Events that trigger this plugin to be loaded
|
||||
event = ["DirChanged"];
|
||||
cmd = ["YourPluginCommand"];
|
||||
|
||||
# keymaps
|
||||
# Plugin Keymaps
|
||||
keys = [
|
||||
# we'll cover this in detail in the keymaps section
|
||||
# We'll cover this in detail in the 'keybinds' section
|
||||
{
|
||||
key = "<leader>d";
|
||||
mode = "n";
|
||||
|
@ -152,7 +236,6 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -163,7 +246,9 @@ require('lz.n').load({
|
|||
{
|
||||
"name-of-your-plugin",
|
||||
after = function()
|
||||
require('your-plugin').setup({--[[ your setupOpts ]]})
|
||||
require('your-plugin').setup({
|
||||
--[[ your setupOpts ]]--
|
||||
})
|
||||
end,
|
||||
|
||||
event = {"DirChanged"},
|
||||
|
@ -175,5 +260,7 @@ require('lz.n').load({
|
|||
})
|
||||
```
|
||||
|
||||
A full list of options can be found
|
||||
[here](https://notashelf.github.io/nvf/options.html#opt-vim.lazy.plugins
|
||||
[`vim.lazy.plugins` spec]: https://notashelf.github.io/nvf/options.html#opt-vim.lazy.plugins
|
||||
|
||||
A full list of options can be found in the [`vim.lazy.plugins` spec] on the
|
||||
rendered manual.
|
||||
|
|
|
@ -30,8 +30,8 @@ There are many settings available in the options. Please refer to the
|
|||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps) to
|
||||
see a list of them.
|
||||
|
||||
**nvf** provides a helper function, so that you don't have to write the
|
||||
mapping attribute sets every time:
|
||||
**nvf** provides a helper function, so that you don't have to write the mapping
|
||||
attribute sets every time:
|
||||
|
||||
- `mkKeymap`, which mimics neovim's `vim.keymap.set` function
|
||||
|
||||
|
|
33
docs/manual/installation/modules/flakes.md
Normal file
33
docs/manual/installation/modules/flakes.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
### Prerequisites {#sec-flakes-prerequisites}
|
||||
|
||||
To install nvf with flakes, you must make sure the following requirements are
|
||||
met.
|
||||
|
||||
1. Nix 2.4 or later must be installed. You may use `nix-shell` to get a later
|
||||
version of Nix from nixpkgs.
|
||||
2. Flake-related experimental features must be enabled. Namely, you need
|
||||
`nix-command` and `flakes`. Some Nix vendors enable those by default, please
|
||||
consult their documentation if you are not using mainstream Nix.
|
||||
- When using NixOS, add the following to your `configuration.nix` and rebuild
|
||||
your system.
|
||||
|
||||
```nix
|
||||
nix.settings.experimental-features = "nix-command flakes";
|
||||
```
|
||||
|
||||
- If you are not using NixOS, add the following to `nix.conf` (located at
|
||||
`~/.config/nix/` or `/etc/nix/nix.conf`).
|
||||
|
||||
```bash
|
||||
experimental-features = nix-command flakes
|
||||
```
|
||||
|
||||
- You may need to restart the Nix daemon with, for example,
|
||||
`sudo systemctl restart nix-daemon.service`.
|
||||
|
||||
- Alternatively, you can enable flakes on a per-command basis with the
|
||||
following additional flags to `nix` and `home-manager`:
|
||||
|
||||
```sh
|
||||
$ nix --extra-experimental-features "nix-command flakes" <sub-commands>
|
||||
```
|
|
@ -5,9 +5,18 @@ inside the home-manager configuration without having to call for the wrapper
|
|||
yourself. It is the recommended way to use **nvf** alongside the NixOS module
|
||||
depending on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
## With Flakes {#sec-hm-flakes}
|
||||
|
||||
```{=include=}
|
||||
flakes.md
|
||||
```
|
||||
|
||||
### Usage {#sec-hm-flakes-usage}
|
||||
|
||||
To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
|
@ -16,7 +25,7 @@ To use it, we first add the input flake.
|
|||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
url = "github:NotAShelf/nvf";
|
||||
# You can override the input nixpkgs to follow your system's
|
||||
# instance of nixpkgs. This is safe to do as nvf does not depend
|
||||
# on a binary cache.
|
||||
|
@ -25,6 +34,8 @@ To use it, we first add the input flake.
|
|||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -39,7 +50,7 @@ Followed by importing the home-manager module somewhere in your configuration.
|
|||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-hm}
|
||||
### Example Installation {#sec-example-installation-hm}
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -66,7 +77,8 @@ Once the module is properly imported by your host, you will be able to use the
|
|||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
```nix
|
||||
{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
|
@ -89,3 +101,45 @@ installation sections of the manual. You may find all available options in the
|
|||
[appendix](https://notashelf.github.io/nvf/options)
|
||||
|
||||
:::
|
||||
|
||||
## Without Flakes {#sec-hm-flakeless}
|
||||
|
||||
As of v0.8, it is possible to install **nvf** on a system if you are not using
|
||||
flakes. This is possible thanks to the flake-compat project.
|
||||
|
||||
To get started, you must fetch the repository using `builtins.fetchTarball` or a
|
||||
similar mechanism.
|
||||
|
||||
```nix
|
||||
# home.nix
|
||||
let
|
||||
nvf = import (builtins.fetchTarball {
|
||||
url = "https://github.com/notashelf/nvf/archive/<commit or tag>.tar.gz";
|
||||
# Optionally, you can add 'sha256' for verification and caching
|
||||
# sha256 = "<sha256>";
|
||||
});
|
||||
in {
|
||||
imports = [
|
||||
# Import the NixOS module from your fetched input
|
||||
nvf.homeManagerModules.nvf
|
||||
];
|
||||
|
||||
# Once the module is imported, you may use `programs.nvf` as exposed by the
|
||||
# NixOS module.
|
||||
programs.nvf.enable = true;
|
||||
}
|
||||
```
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
[niv]: https://github.com/nmattia/niv
|
||||
|
||||
::: {.tip}
|
||||
|
||||
Nix2 does not have a builtin lockfile mechanism like flakes. As such you must
|
||||
manually update the URL and hash for your input. This is annoying to deal with,
|
||||
and most users choose to defer this task to projects such as [npins] or [niv].
|
||||
If you are new to NixOS, I encourage you to look into Flakes and see if they fit
|
||||
your use case. Alternatively, look into the aforementioned projects for more
|
||||
convenient dependency management mechanisms.
|
||||
|
||||
:::
|
||||
|
|
|
@ -5,9 +5,18 @@ the NixOS configuration without having to call for the wrapper yourself. It is
|
|||
the recommended way to use **nvf** alongside the home-manager module depending
|
||||
on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
## With Flakes {#sec-nixos-flakes}
|
||||
|
||||
```{=include=}
|
||||
flakes.md
|
||||
```
|
||||
|
||||
### Usage {#sec-nixos-flakes-usage}
|
||||
|
||||
To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
|
@ -16,7 +25,7 @@ To use it, we first add the input flake.
|
|||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
url = "github:NotAShelf/nvf";
|
||||
# You can override the input nixpkgs to follow your system's
|
||||
# instance of nixpkgs. This is safe to do as nvf does not depend
|
||||
# on a binary cache.
|
||||
|
@ -25,6 +34,8 @@ To use it, we first add the input flake.
|
|||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
||||
# ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -39,7 +50,7 @@ Followed by importing the NixOS module somewhere in your configuration.
|
|||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-nixos}
|
||||
### Example Installation {#sec-example-installation-nixos}
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -64,10 +75,12 @@ Once the module is properly imported by your host, you will be able to use the
|
|||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
```nix
|
||||
{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
|
||||
# Your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
settings = {
|
||||
vim.viAlias = false;
|
||||
|
@ -87,3 +100,45 @@ installation sections of the manual. You may find all available options in the
|
|||
[appendix](https://notashelf.github.io/nvf/options)
|
||||
|
||||
:::
|
||||
|
||||
## Without Flakes {#sec-nixos-flakeless}
|
||||
|
||||
As of v0.8, it is possible to install **nvf** on a system if you are not using
|
||||
flakes. This is possible thanks to the flake-compat project.
|
||||
|
||||
To get started, you must fetch the repository using `builtins.fetchTarball` or a
|
||||
similar mechanism.
|
||||
|
||||
```nix
|
||||
# configuration.nix
|
||||
let
|
||||
nvf = import (builtins.fetchTarball {
|
||||
url = "https://github.com/notashelf/nvf/archive/<commit or tag>.tar.gz";
|
||||
# Optionally, you can add 'sha256' for verification and caching
|
||||
# sha256 = "<sha256>";
|
||||
});
|
||||
in {
|
||||
imports = [
|
||||
# Import the NixOS module from your fetched input
|
||||
nvf.nixosModules.nvf
|
||||
];
|
||||
|
||||
# Once the module is imported, you may use `programs.nvf` as exposed by the
|
||||
# NixOS module.
|
||||
programs.nvf.enable = true;
|
||||
}
|
||||
```
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
[niv]: https://github.com/nmattia/niv
|
||||
|
||||
::: {.tip}
|
||||
|
||||
Nix2 does not have a builtin lockfile mechanism like flakes. As such you must
|
||||
manually update the URL and hash for your input. This is annoying to deal with,
|
||||
and most users choose to defer this task to projects such as [npins] or [niv].
|
||||
If you are new to NixOS, I encourage you to look into Flakes and see if they fit
|
||||
your use case. Alternatively, look into the aforementioned projects for more
|
||||
convenient dependency management mechanisms.
|
||||
|
||||
:::
|
||||
|
|
|
@ -49,7 +49,8 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
# ...
|
||||
modules = [
|
||||
# This will make wrapped neovim available in your system packages
|
||||
# Can also move this to another config file if you pass inputs/self around with specialArgs
|
||||
# Can also move this to another config file if you pass your own
|
||||
# inputs/self around with specialArgs
|
||||
({pkgs, ...}: {
|
||||
environment.systemPackages = [self.packages.${pkgs.stdenv.system}.neovim];
|
||||
})
|
||||
|
@ -58,4 +59,5 @@ the default theme enabled. You may use other options inside `config.vim` in
|
|||
};
|
||||
};
|
||||
};
|
||||
}```
|
||||
}
|
||||
```
|
||||
|
|
|
@ -5,19 +5,20 @@ installing it to your machine. Below are the commands you may run to try out
|
|||
different configurations provided by this flake. As of v0.5, two specialized
|
||||
configurations are provided:
|
||||
|
||||
- **Nix** - Nix language server + simple utility plugins
|
||||
- **Maximal** - Variable language servers + utility and decorative plugins
|
||||
- **Nix** (`packages.nix`) - Nix language server + simple utility plugins
|
||||
- **Maximal** (`packages.maximal`) - Variable language servers + utility and
|
||||
decorative plugins
|
||||
|
||||
You may try out any of the provided configurations using the `nix run` command
|
||||
on a system where Nix is installed.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
$ cachix use nvf # Optional: it'll save you CPU resources and time
|
||||
$ nix run github:notashelf/nvf#nix # will run the default minimal configuration
|
||||
$ nix run github:notashelf/nvf#nix # Will run the default minimal configuration
|
||||
```
|
||||
|
||||
Do keep in mind that this is **susceptible to garbage collection** meaning it
|
||||
will be removed from your Nix store once you garbage collect.
|
||||
Do keep in mind that this is **susceptible to garbage collection** meaning that
|
||||
the built outputs will be removed from your Nix store once you garbage collect.
|
||||
|
||||
## Using Prebuilt Configs {#sec-using-prebuilt-configs}
|
||||
|
||||
|
@ -65,6 +66,7 @@ companion or fun plugins.
|
|||
::: {.warning}
|
||||
|
||||
Running the maximal config will download _a lot_ of packages as it is
|
||||
downloading language servers, formatters, and more.
|
||||
downloading language servers, formatters, and more. If CPU time and bandwidth
|
||||
are concerns, please use the default package instead.
|
||||
|
||||
:::
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
||||
[colorful-menu.nvim]: https://github.com/xzbdmw/colorful-menu.nvim
|
||||
[oil.nvim]: https://github.com/stevearc/oil.nvim
|
||||
[hunk.nvim]: https://github.com/julienvincent/hunk.nvim
|
||||
[undotree]: https://github.com/mbbill/undotree
|
||||
|
||||
- Add [typst-preview.nvim] under
|
||||
`languages.typst.extensions.typst-preview-nvim`.
|
||||
|
@ -93,9 +96,10 @@
|
|||
|
||||
- Lazyload Lspsaga and remove default keybindings for it.
|
||||
|
||||
- Add [colorful-menu.nvim] to enhance the completion menus, with optional
|
||||
integration for blink-cmp and nvim-cmp
|
||||
- Add [oil.nvim] as an alternative file explorer. It will be available under
|
||||
`vim.utility.oil-nvim`.
|
||||
|
||||
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
|
||||
options for `vim.diagnostic.config()` can now be customized through the
|
||||
[](#opt-vim.diagnostics.config) in nvf.
|
||||
|
@ -104,6 +108,8 @@
|
|||
relevant packages in a simple UI.
|
||||
- This deprecates `vim.useSystemClipboard` as well, see breaking changes
|
||||
section above for migration options.
|
||||
- Add [hunk.nvim], Neovim plugin & tool for splitting diffs in Neovim. Available
|
||||
as `vim.git.hunk-nvim`
|
||||
|
||||
[amadaluzia](https://github.com/amadaluzia):
|
||||
|
||||
|
@ -434,7 +440,7 @@
|
|||
|
||||
- Add missing `transparent` option for existing
|
||||
[onedark.nvim](https://github.com/navarasu/onedark.nvim) theme.
|
||||
|
||||
|
||||
[theutz](https://github.com/theutz):
|
||||
|
||||
- Added "auto" flavour for catppuccin theme
|
||||
|
@ -446,19 +452,21 @@
|
|||
[neogit]: https://github.com/NeogitOrg/neogit
|
||||
|
||||
- Add [solarized.nvim] theme with support for multiple variants
|
||||
- Add [smart-splits.nvim] for navigating between Neovim windows and terminal multiplexer panes.
|
||||
Available at `vim.utility.smart-splits`.
|
||||
- Restore vim-dirtytalk plugin and fix ordering with spellcheck in generated config.
|
||||
- Add [smart-splits.nvim] for navigating between Neovim windows and terminal
|
||||
multiplexer panes. Available at `vim.utility.smart-splits`.
|
||||
- Restore vim-dirtytalk plugin and fix ordering with spellcheck in generated
|
||||
config.
|
||||
- Fix lualine separator options
|
||||
- Add [neogit], an interactive and powerful Git interface for Neovim, inspired by Magit
|
||||
- Add [neogit], an interactive and powerful Git interface for Neovim, inspired
|
||||
by Magit
|
||||
- Allow deregistering which-key binds or groups by setting them to `null`
|
||||
|
||||
[justDeeevin](https://github.com/justDeeevin):
|
||||
|
||||
[supermaven-nvim]: https://github.com/supermaven-inc/supermaven-nvim
|
||||
|
||||
- Add [supermaven-nvim] plugin in `vim.assistant.supermaven-nvim` with `enable` and
|
||||
`setupOpts`
|
||||
- Add [supermaven-nvim] plugin in `vim.assistant.supermaven-nvim` with `enable`
|
||||
and `setupOpts`
|
||||
|
||||
[trueNAHO](https://github.com/trueNAHO):
|
||||
|
||||
|
@ -466,13 +474,28 @@
|
|||
download size.
|
||||
|
||||
- `flake-utils`'s `systems` inputs follows nvf's `systems` input to transitively
|
||||
leverage the pattern introduced in commit [fc8206e7a61d ("flake: utilize
|
||||
nix-systems for overridable flake systems")](
|
||||
https://github.com/NotAShelf/nvf/commit/fc8206e7a61d7eb02006f9010e62ebdb3336d0d2).
|
||||
leverage the pattern introduced in commit
|
||||
[fc8206e7a61d ("flake: utilize
|
||||
nix-systems for overridable flake systems")](https://github.com/NotAShelf/nvf/commit/fc8206e7a61d7eb02006f9010e62ebdb3336d0d2).
|
||||
|
||||
[soliprem](https://github.com/soliprem):
|
||||
|
||||
|
||||
- fix broken `neorg` grammars
|
||||
- remove obsolete warning in the `otter` module
|
||||
|
||||
[Cool-Game-Dev](https://github.com/Cool-Game-Dev):
|
||||
|
||||
[nvim-biscuits]: https://github.com/code-biscuits/nvim-biscuits
|
||||
|
||||
- Add [nvim-biscuits] to show block context. Available at
|
||||
`vim.utility.nvim-biscuits`.
|
||||
|
||||
[JManch](https://github.com/JManch):
|
||||
|
||||
- Fix default [blink.cmp] sources "path" and "buffer" not working when
|
||||
`autocomplete.nvim-cmp.enable` was disabled and
|
||||
`autocomplete.nvim-cmp.sources` had not been modified.
|
||||
|
||||
[Cool-Game-Dev](https://github.com/Cool-Game-Dev):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue