mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-09 17:49:49 +01:00
Compare commits
24 commits
2bc3adf8ae
...
fb404c01a3
Author | SHA1 | Date | |
---|---|---|---|
|
fb404c01a3 | ||
a1bac1d356 | |||
|
de02e2fa57 | ||
|
c071f2caa2 | ||
|
92e38fbfae | ||
|
ee4c072ba3 | ||
9888a277ad | |||
b7bea89d9a | |||
9584fe25e2 | |||
eb6e8b17b7 | |||
fcc6aa485c | |||
e614860a12 | |||
|
af0eed84e0 | ||
|
ecc9b60a2d | ||
|
fcbc49e2e5 | ||
|
59bf01bbe0 | ||
|
9ccd0bfd4e | ||
|
411e641eab | ||
|
98b36e08f0 | ||
|
8c1352502a | ||
|
7d043e5f14 | ||
|
26398b6b14 | ||
|
f9d1684b5f | ||
|
4eeadf3c96 |
35 changed files with 573 additions and 359 deletions
36
.github/README.md
vendored
36
.github/README.md
vendored
|
@ -206,6 +206,16 @@ features.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
### Co-Maintainers
|
||||||
|
|
||||||
|
Alongside myself, nvf is developed by those talented folk:
|
||||||
|
|
||||||
|
- [**@horriblename**](https://github.com/horriblename) - For actively
|
||||||
|
implementing planned features and quality of life updates.
|
||||||
|
- [**@Diniamo**](https://github.com/Diniamo)
|
||||||
|
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
||||||
|
pull requests, issues and assistance with maintenance of nvf.
|
||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
[mnw]: https://github.com/gerg-l/mnw
|
[mnw]: https://github.com/gerg-l/mnw
|
||||||
|
@ -213,21 +223,19 @@ features.
|
||||||
nvf would not be what it is today without the awesome people below. Special,
|
nvf would not be what it is today without the awesome people below. Special,
|
||||||
heart-felt thanks to
|
heart-felt thanks to
|
||||||
|
|
||||||
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts and
|
- [**@fufexan**](https://github.com/fufexan) - For the transition to flake-parts
|
||||||
invaluable Nix assistance.
|
and invaluable Nix assistance.
|
||||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting home-manager module to
|
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||||
work and Nix assistance.
|
to work and Nix assistance.
|
||||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
|
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
possible, and other module additions.
|
possible, and other module additions.
|
||||||
- [@horriblename](https://github.com/horriblename) - For actively implementing
|
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
planned features and quality of life updates.
|
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
||||||
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
that I could not.
|
||||||
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
|
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||||
could not.
|
[mnw], and occasional code improvements.
|
||||||
- [@Diniamo](https://github.com/Diniamo) - For actively submitting pull
|
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
||||||
requests, issues and assistance with maintenance of nvf.
|
features and excellent work on new language modules.
|
||||||
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, [mnw],
|
|
||||||
and occasional code improvements.
|
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,15 @@ Followed by importing the home-manager module somewhere in your configuration.
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, home-manager, nvf, ... }: let
|
outputs = { nixpkgs, home-manager, nvf, ... }: let
|
||||||
system = "x86_64-linux"; in {
|
system = "x86_64-linux";
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
# ↓ this is your home output in the flake schema, expected by home-manager
|
# ↓ this is your home output in the flake schema, expected by home-manager
|
||||||
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration
|
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
modules = [
|
modules = [
|
||||||
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
||||||
./home.nix # <- your home entrypoint
|
./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,13 +42,12 @@ Followed by importing the NixOS module somewhere in your configuration.
|
||||||
nvf.url = "github:notashelf/nvf";
|
nvf.url = "github:notashelf/nvf";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, nvf, ... }: let
|
outputs = { nixpkgs, nvf, ... }: {
|
||||||
system = "x86_64-linux"; in {
|
|
||||||
# ↓ this is your host output in the flake schema
|
# ↓ this is your host output in the flake schema
|
||||||
nixosConfigurations."yourUsername»" = nixpkgs.lib.nixosSystem {
|
nixosConfigurations."your-hostname" = nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
nvf.nixosModules.default # <- this imports the NixOS module that provides the options
|
nvf.nixosModules.default # <- this imports the NixOS module that provides the options
|
||||||
./configuration.nix # <- your host entrypoint
|
./configuration.nix # <- your host entrypoint, `programs.nvf.*` may be defined here
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@ try-it-out.md
|
||||||
default-configs.md
|
default-configs.md
|
||||||
installation.md
|
installation.md
|
||||||
configuring.md
|
configuring.md
|
||||||
|
tips.md
|
||||||
```
|
```
|
||||||
|
|
||||||
```{=include=} chapters
|
```{=include=} chapters
|
||||||
|
|
6
docs/manual/tips.md
Normal file
6
docs/manual/tips.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Helpful Tips {#ch-helpful-tips}
|
||||||
|
|
||||||
|
```{=include=} chapters
|
||||||
|
tips/debugging-nvf.md
|
||||||
|
tips/offline-docs.md
|
||||||
|
```
|
19
docs/manual/tips/debugging-nvf.md
Normal file
19
docs/manual/tips/debugging-nvf.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Debugging nvf {#sec-debugging-nvf}
|
||||||
|
|
||||||
|
There may be instances where the your Nix configuration evaluates to invalid
|
||||||
|
Lua, or times when you will be asked to provide your built Lua configuration for
|
||||||
|
easier debugging by nvf maintainers. nvf provides two helpful utilities out of
|
||||||
|
the box.
|
||||||
|
|
||||||
|
**nvf-print-config** and **nvf-print-config-path** will be bundled with nvf as
|
||||||
|
lightweight utilities to help you view or share your built configuration when
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
To view your configuration with syntax highlighting, you may use the
|
||||||
|
[bat pager](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nvf-print-config | bat --language=lua
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, `cat` or `less` may also be used.
|
11
docs/manual/tips/offline-docs.md
Normal file
11
docs/manual/tips/offline-docs.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Offline Documentation {#sec-offline-documentation}
|
||||||
|
|
||||||
|
[https://notashelf.github.io/nvf/options.html]: https://notashelf.github.io/nvf/options.html
|
||||||
|
|
||||||
|
The manpages provided by nvf contains an offline version of the option search
|
||||||
|
normally available at [https://notashelf.github.io/nvf/options.html]. You may
|
||||||
|
use the `man 5 nvf` command to view option documentation from the comfort of
|
||||||
|
your terminal.
|
||||||
|
|
||||||
|
Note that this is only available for NixOS and Home-Manager module
|
||||||
|
installations.
|
|
@ -13,6 +13,9 @@
|
||||||
- Add [render-markdown.nvim] under
|
- Add [render-markdown.nvim] under
|
||||||
`languages.markdown.extensions.render-markdown-nvim`
|
`languages.markdown.extensions.render-markdown-nvim`
|
||||||
|
|
||||||
|
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
||||||
|
in gitsigns configuration.
|
||||||
|
|
||||||
[amadaluzia](https://github.com/amadaluzia):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
@ -25,3 +28,9 @@
|
||||||
|
|
||||||
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
|
[horriblename](https://github.com/horriblename):
|
||||||
|
|
||||||
|
[aerial.nvim](https://github.com/stevearc/aerial.nvim)
|
||||||
|
|
||||||
|
- Add [aerial.nvim]
|
||||||
|
|
17
flake.lock
17
flake.lock
|
@ -156,6 +156,22 @@
|
||||||
"type": "sourcehut"
|
"type": "sourcehut"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-aerial-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1736064692,
|
||||||
|
"narHash": "sha256-7YQtkUTACTMfAGoqoFDPmRrqtw+ypxDbeLCTB3sy4Us=",
|
||||||
|
"owner": "stevearc",
|
||||||
|
"repo": "aerial.nvim",
|
||||||
|
"rev": "b3ec25ca8c347fafa976484a6cace162239112e1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "stevearc",
|
||||||
|
"repo": "aerial.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-alpha-nvim": {
|
"plugin-alpha-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -2090,6 +2106,7 @@
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
"nmd": "nmd",
|
||||||
|
"plugin-aerial-nvim": "plugin-aerial-nvim",
|
||||||
"plugin-alpha-nvim": "plugin-alpha-nvim",
|
"plugin-alpha-nvim": "plugin-alpha-nvim",
|
||||||
"plugin-base16": "plugin-base16",
|
"plugin-base16": "plugin-base16",
|
||||||
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
|
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
|
||||||
|
|
14
flake.nix
14
flake.nix
|
@ -31,7 +31,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
homeManagerModules = {
|
homeManagerModules = {
|
||||||
nvf = import ./flake/modules/home-manager.nix self.packages lib;
|
nvf = import ./flake/modules/home-manager.nix {inherit lib self;};
|
||||||
default = self.homeManagerModules.nvf;
|
default = self.homeManagerModules.nvf;
|
||||||
neovim-flake =
|
neovim-flake =
|
||||||
lib.warn ''
|
lib.warn ''
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
nvf = import ./flake/modules/nixos.nix self.packages lib;
|
nvf = import ./flake/modules/nixos.nix {inherit lib self;};
|
||||||
default = self.nixosModules.nvf;
|
default = self.nixosModules.nvf;
|
||||||
neovim-flake =
|
neovim-flake =
|
||||||
lib.warn ''
|
lib.warn ''
|
||||||
|
@ -726,9 +726,19 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-R-nvim = {
|
||||||
|
url = "github:R-nvim/R.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-haskell-tools-nvim = {
|
plugin-haskell-tools-nvim = {
|
||||||
url = "github:mrcjkb/haskell-tools.nvim";
|
url = "github:mrcjkb/haskell-tools.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-aerial-nvim = {
|
||||||
|
url = "github:stevearc/aerial.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
# Home Manager module
|
# Home Manager module
|
||||||
packages: lib: {
|
{
|
||||||
|
self,
|
||||||
|
lib,
|
||||||
|
}: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (self) packages inputs;
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf mkAliasOptionModule;
|
inherit (lib.modules) mkIf mkAliasOptionModule;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything bool;
|
inherit (lib.types) anything bool submoduleWith;
|
||||||
inherit (lib.nvim) neovimConfiguration;
|
|
||||||
inherit (lib.nvim.types) anythingConcatLists;
|
|
||||||
|
|
||||||
cfg = config.programs.nvf;
|
cfg = config.programs.nvf;
|
||||||
|
|
||||||
neovimConfigured = neovimConfiguration {
|
nvfModule = submoduleWith {
|
||||||
inherit pkgs;
|
description = "Nvf module";
|
||||||
modules = [cfg.settings];
|
class = "nvf";
|
||||||
|
specialArgs = {
|
||||||
|
inherit pkgs lib inputs;
|
||||||
|
};
|
||||||
|
modules = import ../../modules/modules.nix {inherit pkgs lib;};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -55,7 +61,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = attrsOf anythingConcatLists;
|
type = nvfModule;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Attribute set of nvf preferences.";
|
description = "Attribute set of nvf preferences.";
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
|
@ -78,7 +84,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.nvf.finalPackage = neovimConfigured.neovim;
|
programs.nvf.finalPackage = cfg.settings.vim.build.finalPackage;
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
# NixOS module
|
# NixOS module
|
||||||
packages: lib: {
|
{
|
||||||
|
self,
|
||||||
|
lib,
|
||||||
|
}: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (self) inputs packages;
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf mkOverride mkAliasOptionModule;
|
inherit (lib.modules) mkIf mkOverride mkAliasOptionModule;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything bool;
|
inherit (lib.types) anything bool submoduleWith;
|
||||||
inherit (lib.nvim) neovimConfiguration;
|
|
||||||
inherit (lib.nvim.types) anythingConcatLists;
|
|
||||||
|
|
||||||
cfg = config.programs.nvf;
|
cfg = config.programs.nvf;
|
||||||
|
|
||||||
neovimConfigured = neovimConfiguration {
|
nvfModule = submoduleWith {
|
||||||
inherit pkgs;
|
description = "Nvf module";
|
||||||
modules = [cfg.settings];
|
class = "nvf";
|
||||||
|
specialArgs = {
|
||||||
|
inherit pkgs lib inputs;
|
||||||
|
};
|
||||||
|
modules = import ../../modules/modules.nix {inherit pkgs lib;};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -55,7 +61,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = attrsOf anythingConcatLists;
|
type = nvfModule;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Attribute set of nvf preferences.";
|
description = "Attribute set of nvf preferences.";
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
|
@ -78,7 +84,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.nvf.finalPackage = neovimConfigured.neovim;
|
programs.nvf.finalPackage = cfg.settings.vim.build.finalPackage;
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
||||||
|
|
|
@ -1,57 +1,8 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (lib.options) showOption showFiles getFiles mergeOneOption mergeEqualOption;
|
inherit (lib.options) mergeEqualOption;
|
||||||
inherit (lib.strings) isString isStringLike;
|
inherit (lib.strings) isString stringLength match;
|
||||||
inherit (lib.types) anything attrsOf listOf mkOptionType;
|
inherit (lib.types) listOf mkOptionType;
|
||||||
inherit (lib.nvim.types) anythingConcatLists;
|
|
||||||
inherit (builtins) typeOf isAttrs any head concatLists stringLength match;
|
|
||||||
in {
|
in {
|
||||||
# HACK: Does this break anything in our case?
|
|
||||||
# A modified version of the nixpkgs anything type that concatenates lists
|
|
||||||
# This isn't the default because the order in which the lists are concatenated depends on the order in which the modules are imported,
|
|
||||||
# which makes it non-deterministic
|
|
||||||
anythingConcatLists =
|
|
||||||
anything
|
|
||||||
// {
|
|
||||||
merge = loc: defs: let
|
|
||||||
getType = value:
|
|
||||||
if isAttrs value && isStringLike value
|
|
||||||
then "stringCoercibleSet"
|
|
||||||
else typeOf value;
|
|
||||||
|
|
||||||
# Throw an error if not all defs have the same type
|
|
||||||
checkType = getType (head defs).value;
|
|
||||||
commonType =
|
|
||||||
if any (def: getType def.value != checkType) defs
|
|
||||||
then throw "The option `${showOption loc}' has conflicting option types in ${showFiles (getFiles defs)}"
|
|
||||||
else checkType;
|
|
||||||
|
|
||||||
mergeFunctions = {
|
|
||||||
# Recursively merge attribute sets
|
|
||||||
set = (attrsOf anythingConcatLists).merge;
|
|
||||||
|
|
||||||
# Overridden behavior for lists, that concatenates lists
|
|
||||||
list = _: defs: concatLists (map (e: e.value) defs);
|
|
||||||
|
|
||||||
# This means it's a package, only accept a single definition
|
|
||||||
stringCoercibleSet = mergeOneOption;
|
|
||||||
|
|
||||||
# This works by passing the argument to the functions,
|
|
||||||
# and merging their returns values instead
|
|
||||||
lambda = loc: defs: arg:
|
|
||||||
anythingConcatLists.merge
|
|
||||||
(loc ++ ["<function body>"])
|
|
||||||
(map (def: {
|
|
||||||
inherit (def) file;
|
|
||||||
value = def.value arg;
|
|
||||||
})
|
|
||||||
defs);
|
|
||||||
};
|
|
||||||
in
|
|
||||||
# Merge the defs with the correct function from above, if available
|
|
||||||
# otherwise only allow equal values
|
|
||||||
(mergeFunctions.${commonType} or mergeEqualOption) loc defs;
|
|
||||||
};
|
|
||||||
|
|
||||||
mergelessListOf = elemType: let
|
mergelessListOf = elemType: let
|
||||||
super = listOf elemType;
|
super = listOf elemType;
|
||||||
in
|
in
|
||||||
|
|
|
@ -11,5 +11,5 @@ in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
inherit (customTypes) anythingConcatLists char hexColor mergelessListOf;
|
inherit (customTypes) char hexColor mergelessListOf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
extraModules ? [],
|
extraModules ? [],
|
||||||
configuration ? {},
|
configuration ? {},
|
||||||
}: let
|
}: let
|
||||||
inherit (pkgs) vimPlugins;
|
inherit (lib.strings) toString;
|
||||||
inherit (lib.strings) isString toString;
|
inherit (lib.lists) concatLists;
|
||||||
inherit (lib.lists) filter map concatLists;
|
|
||||||
|
|
||||||
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||||
# check can be disabled while calling this file is called
|
# check can be disabled while calling this file is called
|
||||||
|
@ -21,7 +20,12 @@
|
||||||
# evaluate the extended library with the modules
|
# evaluate the extended library with the modules
|
||||||
# optionally with any additional modules passed by the user
|
# optionally with any additional modules passed by the user
|
||||||
module = lib.evalModules {
|
module = lib.evalModules {
|
||||||
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
|
specialArgs =
|
||||||
|
extraSpecialArgs
|
||||||
|
// {
|
||||||
|
inherit inputs;
|
||||||
|
modulesPath = toString ./.;
|
||||||
|
};
|
||||||
modules = concatLists [
|
modules = concatLists [
|
||||||
nvimModules
|
nvimModules
|
||||||
modules
|
modules
|
||||||
|
@ -36,102 +40,11 @@
|
||||||
extraModules))
|
extraModules))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# alias to the internal configuration
|
|
||||||
vimOptions = module.config.vim;
|
|
||||||
|
|
||||||
noBuildPlug = {pname, ...} @ attrs: let
|
|
||||||
src = inputs."plugin-${attrs.pname}";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
version = src.shortRev or src.shortDirtyRev or "dirty";
|
|
||||||
outPath = src;
|
|
||||||
passthru.vimPlugin = false;
|
|
||||||
}
|
|
||||||
// attrs;
|
|
||||||
|
|
||||||
# build a vim plugin with the given name and arguments
|
|
||||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
|
||||||
# instead
|
|
||||||
buildPlug = attrs: let
|
|
||||||
src = inputs."plugin-${attrs.pname}";
|
|
||||||
in
|
|
||||||
pkgs.vimUtils.buildVimPlugin (
|
|
||||||
{
|
|
||||||
version = src.shortRev or src.shortDirtyRev or "dirty";
|
|
||||||
inherit src;
|
|
||||||
}
|
|
||||||
// attrs
|
|
||||||
);
|
|
||||||
|
|
||||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
|
||||||
|
|
||||||
pluginBuilders = {
|
|
||||||
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
|
|
||||||
flutter-tools-patched = buildPlug {
|
|
||||||
pname = "flutter-tools";
|
|
||||||
patches = [../patches/flutter-tools.patch];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
buildConfigPlugins = plugins:
|
|
||||||
map (
|
|
||||||
plug:
|
|
||||||
if (isString plug)
|
|
||||||
then pluginBuilders.${plug} or (noBuildPlug {pname = plug;})
|
|
||||||
else plug
|
|
||||||
) (filter (f: f != null) plugins);
|
|
||||||
|
|
||||||
# built (or "normalized") plugins that are modified
|
|
||||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
|
||||||
builtOptPlugins = map (package: package // {optional = true;}) (buildConfigPlugins vimOptions.optPlugins);
|
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
|
||||||
# to conform to the format mnw expects. end user should
|
|
||||||
# only ever need to pass a list of packages, which are modified
|
|
||||||
# here
|
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
|
||||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
|
||||||
|
|
||||||
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
|
||||||
# generate a wrapped Neovim package.
|
|
||||||
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
|
||||||
neovim = vimOptions.package;
|
|
||||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
|
||||||
appName = "nvf";
|
|
||||||
extraBinPath = vimOptions.extraPackages;
|
|
||||||
initLua = vimOptions.builtLuaConfigRC;
|
|
||||||
luaFiles = vimOptions.extraLuaFiles;
|
|
||||||
|
|
||||||
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
|
||||||
inherit extraLuaPackages extraPython3Packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
dummyInit = pkgs.writeText "nvf-init.lua" vimOptions.builtLuaConfigRC;
|
|
||||||
# Additional helper scripts for printing and displaying nvf configuration
|
|
||||||
# in your commandline.
|
|
||||||
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}";
|
|
||||||
printConfigPath = pkgs.writers.writeDashBin "nvf-print-config-path" "echo -n ${dummyInit}";
|
|
||||||
in {
|
in {
|
||||||
inherit (module) options config;
|
inherit (module) options config;
|
||||||
inherit (module._module.args) pkgs;
|
inherit (module._module.args) pkgs;
|
||||||
|
|
||||||
# Expose wrapped neovim-package for userspace
|
# Expose wrapped neovim-package for userspace
|
||||||
# or module consumption.
|
# or module consumption.
|
||||||
neovim = pkgs.symlinkJoin {
|
neovim = module.config.vim.build.finalPackage;
|
||||||
name = "nvf-with-helpers";
|
|
||||||
paths = [neovim-wrapped printConfig printConfigPath];
|
|
||||||
postBuild = "echo Helpers added";
|
|
||||||
|
|
||||||
# Allow evaluating vimOptions, i.e., config.vim from the packages' passthru
|
|
||||||
# attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig
|
|
||||||
# will return the configuration in full.
|
|
||||||
passthru.neovimConfig = vimOptions;
|
|
||||||
|
|
||||||
meta =
|
|
||||||
neovim-wrapped.meta
|
|
||||||
// {
|
|
||||||
description = "Wrapped Neovim package with helper scripts to print the config (path)";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
# using the configuration passed in `neovim` and `plugins` modules.
|
# using the configuration passed in `neovim` and `plugins` modules.
|
||||||
wrapper = map (p: ./wrapper + "/${p}") [
|
wrapper = map (p: ./wrapper + "/${p}") [
|
||||||
"build"
|
"build"
|
||||||
|
"environment"
|
||||||
"rc"
|
"rc"
|
||||||
"warnings"
|
"warnings"
|
||||||
"lazy"
|
"lazy"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
|
options,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
@ -11,8 +11,7 @@
|
||||||
inherit (lib.nvim.binds) pushDownDefault;
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
|
||||||
cfg = config.vim.filetree.nvimTree;
|
cfg = config.vim.filetree.nvimTree;
|
||||||
self = import ./nvimtree.nix {inherit pkgs lib;};
|
inherit (options.vim.filetree.nvimTree) mappings;
|
||||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.git.gitsigns;
|
cfg = config.vim.git.gitsigns;
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.gitsigns = entryAnywhere ''
|
pluginRC.gitsigns = entryAnywhere ''
|
||||||
require('gitsigns').setup{}
|
require('gitsigns').setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.modules) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule ["vim" "git" "gitsigns" "codeActions" "vim" "gitsigns" "codeActions"] ["vim" "git" "gitsigns" "codeActions" "enable"])
|
(mkRenamedOptionModule ["vim" "git" "gitsigns" "codeActions" "vim" "gitsigns" "codeActions"] ["vim" "git" "gitsigns" "codeActions" "enable"])
|
||||||
|
@ -13,6 +14,7 @@ in {
|
||||||
|
|
||||||
options.vim.git.gitsigns = {
|
options.vim.git.gitsigns = {
|
||||||
enable = mkEnableOption "gitsigns" // {default = config.vim.git.enable;};
|
enable = mkEnableOption "gitsigns" // {default = config.vim.git.enable;};
|
||||||
|
setupOpts = mkPluginSetupOption "gitsigns" {};
|
||||||
|
|
||||||
codeActions.enable = mkEnableOption "gitsigns codeactions through null-ls";
|
codeActions.enable = mkEnableOption "gitsigns codeactions through null-ls";
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,13 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str nullOr attrsOf;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.r;
|
cfg = config.vim.languages.r;
|
||||||
|
|
||||||
|
@ -74,7 +76,12 @@ in {
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
package = mkGrammarOption pkgs "r";
|
rPackage = mkGrammarOption pkgs "r";
|
||||||
|
rnowebPackage = mkGrammarOption pkgs "rnoweb";
|
||||||
|
mdPackage = mkGrammarOption pkgs "markdown";
|
||||||
|
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
|
||||||
|
yamlPackage = mkGrammarOption pkgs "yaml";
|
||||||
|
csvPackage = mkGrammarOption pkgs "csv";
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
@ -109,14 +116,28 @@ in {
|
||||||
description = "R formatter package";
|
description = "R formatter package";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extensions = {
|
||||||
|
R-nvim = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption ''
|
||||||
|
[R.nvim]: https://github.com/R-Nvim/R.nvim
|
||||||
|
|
||||||
|
R.nvim adds R support to Neovim, including:
|
||||||
|
|
||||||
|
- Communication with R via Neovim's built-in terminal or tmux
|
||||||
|
- A built-in object explorer and autocompletions built from your R environment
|
||||||
|
- Keyboard shortcuts for common inserts like <- and |>
|
||||||
|
- Quarto/R Markdown support
|
||||||
|
''
|
||||||
|
// {default = true;};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "R-nvim" {};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
(mkIf cfg.treesitter.enable {
|
|
||||||
vim.treesitter.enable = true;
|
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.lsp.null-ls.enable = true;
|
||||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
@ -126,5 +147,24 @@ in {
|
||||||
vim.lsp.lspconfig.enable = true;
|
vim.lsp.lspconfig.enable = true;
|
||||||
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [
|
||||||
|
cfg.treesitter.rPackage
|
||||||
|
cfg.treesitter.rnowebPackage
|
||||||
|
cfg.treesitter.mdPackage
|
||||||
|
cfg.treesitter.mdInlinePackage
|
||||||
|
cfg.treesitter.yamlPackage
|
||||||
|
cfg.treesitter.csvPackage
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extensions.R-nvim.enable {
|
||||||
|
vim.startPlugins = ["R-nvim"];
|
||||||
|
vim.pluginRC.R-nvim= entryAnywhere ''
|
||||||
|
require("r").setup(${toLuaObject cfg.extensions.R-nvim.setupOpts})
|
||||||
|
'';
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./outline
|
||||||
./binds
|
./binds
|
||||||
./ccc
|
./ccc
|
||||||
./gestures
|
./gestures
|
||||||
|
|
14
modules/plugins/utility/outline/aerial-nvim/aerial-nvim.nix
Normal file
14
modules/plugins/utility/outline/aerial-nvim/aerial-nvim.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.outline.aerial-nvim = {
|
||||||
|
enable = mkEnableOption "Aerial.nvim";
|
||||||
|
setupOpts = mkPluginSetupOption "aerial.nvim" {};
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
toggle = mkMappingOption "Toggle aerial window" "gO";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
42
modules/plugins/utility/outline/aerial-nvim/config.nix
Normal file
42
modules/plugins/utility/outline/aerial-nvim/config.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
options,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.binds) mkKeymap;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.outline.aerial-nvim;
|
||||||
|
inherit (options.vim.utility.outline.aerial-nvim) mappings;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
lazy.plugins.aerial-nvim = {
|
||||||
|
package = "aerial-nvim";
|
||||||
|
|
||||||
|
setupModule = "aerial";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
cmd = [
|
||||||
|
"AerialClose"
|
||||||
|
"AerialCloseAll"
|
||||||
|
"AerialGo"
|
||||||
|
"AerialInfo"
|
||||||
|
"AerialNavClose"
|
||||||
|
"AerialNavOpen"
|
||||||
|
"AerialNavToggle"
|
||||||
|
"AerialNext"
|
||||||
|
"AerialOpen"
|
||||||
|
"AerialOpenAll"
|
||||||
|
"AerialPrev"
|
||||||
|
"AerialToggle"
|
||||||
|
];
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
(mkKeymap "n" cfg.mappings.toggle ":AerialToggle<CR>" {desc = mappings.toggle.description;})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/utility/outline/aerial-nvim/default.nix
Normal file
6
modules/plugins/utility/outline/aerial-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./aerial-nvim.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
5
modules/plugins/utility/outline/default.nix
Normal file
5
modules/plugins/utility/outline/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./aerial-nvim
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,18 +1,22 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
|
||||||
cfg = config.vim.utility.vim-wakatime;
|
cfg = config.vim.utility.vim-wakatime;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [pkgs.vimPlugins.vim-wakatime];
|
vim = {
|
||||||
|
startPlugins = [pkgs.vimPlugins.vim-wakatime];
|
||||||
|
|
||||||
vim.pluginRC.vim-wakatime = mkIf (cfg.cli-package != null) ''
|
# Wakatime configuration is stored as vim globals.
|
||||||
vim.g.wakatime_CLIPath = "${cfg.cli-package}"
|
globals = {
|
||||||
'';
|
"wakatime_CLIPath" = mkIf (cfg.cli-package != null) "${getExe cfg.cli-package}";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./config.nix
|
./config.nix
|
||||||
./vim-wakatime.nix
|
./vim-wakatime.nix
|
||||||
|
|
|
@ -1,18 +1,24 @@
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) nullOr package;
|
inherit (lib.types) nullOr package;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.vim-wakatime = {
|
options.vim.utility.vim-wakatime = {
|
||||||
enable = mkEnableOption "vim-wakatime: live code statistics";
|
enable = mkEnableOption ''
|
||||||
|
automatic time tracking and metrics generated from your programming activity [vim-wakatime]
|
||||||
|
'';
|
||||||
|
|
||||||
cli-package = mkOption {
|
cli-package = mkOption {
|
||||||
type = nullOr package;
|
type = nullOr package;
|
||||||
default = pkgs.wakatime;
|
default = pkgs.wakatime-cli;
|
||||||
description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`";
|
example = null;
|
||||||
|
description = ''
|
||||||
|
The package that should be used for wakatime-cli.
|
||||||
|
Set as null to use the default path in {env}`$XDG_DATA_HOME`
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,116 @@
|
||||||
{
|
{
|
||||||
config,
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}
|
||||||
inherit (lib.attrsets) attrValues;
|
: let
|
||||||
|
inherit (pkgs) vimPlugins;
|
||||||
|
inherit (lib.strings) isString;
|
||||||
|
inherit (lib.lists) filter map;
|
||||||
|
inherit (builtins) path;
|
||||||
|
|
||||||
cfg = config.vim;
|
# alias to the internal configuration
|
||||||
|
vimOptions = config.vim;
|
||||||
|
|
||||||
|
noBuildPlug = pname: let
|
||||||
|
input = inputs."plugin-${pname}";
|
||||||
|
version = input.shortRev or input.shortDirtyRev or "dirty";
|
||||||
|
in {
|
||||||
|
# vim.lazy.plugins relies on pname, so we only set that here
|
||||||
|
# version isn't needed for anything, but inherit it anyway for correctness
|
||||||
|
inherit pname version;
|
||||||
|
outPath = path {
|
||||||
|
name = "${pname}-0-unstable-${version}";
|
||||||
|
path = input.outPath;
|
||||||
|
};
|
||||||
|
passthru.vimPlugin = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# build a vim plugin with the given name and arguments
|
||||||
|
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||||
|
# instead
|
||||||
|
buildPlug = attrs: let
|
||||||
|
input = inputs."plugin-${attrs.pname}";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin (
|
||||||
|
{
|
||||||
|
version = input.shortRev or input.shortDirtyRev or "dirty";
|
||||||
|
src = input.outPath;
|
||||||
|
}
|
||||||
|
// attrs
|
||||||
|
);
|
||||||
|
|
||||||
|
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||||
|
|
||||||
|
pluginBuilders = {
|
||||||
|
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
|
||||||
|
flutter-tools-patched = buildPlug {
|
||||||
|
pname = "flutter-tools";
|
||||||
|
patches = [./patches/flutter-tools.patch];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
buildConfigPlugins = plugins:
|
||||||
|
map (
|
||||||
|
plug:
|
||||||
|
if (isString plug)
|
||||||
|
then pluginBuilders.${plug} or (noBuildPlug plug)
|
||||||
|
else plug
|
||||||
|
) (filter (f: f != null) plugins);
|
||||||
|
|
||||||
|
# built (or "normalized") plugins that are modified
|
||||||
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
|
builtOptPlugins = map (package: package // {optional = true;}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
|
|
||||||
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
|
# to conform to the format mnw expects. end user should
|
||||||
|
# only ever need to pass a list of packages, which are modified
|
||||||
|
# here
|
||||||
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||||
|
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||||
|
|
||||||
|
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||||
|
# generate a wrapped Neovim package.
|
||||||
|
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
||||||
|
neovim = vimOptions.package;
|
||||||
|
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||||
|
appName = "nvf";
|
||||||
|
extraBinPath = vimOptions.extraPackages;
|
||||||
|
initLua = vimOptions.builtLuaConfigRC;
|
||||||
|
luaFiles = vimOptions.extraLuaFiles;
|
||||||
|
|
||||||
|
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
||||||
|
inherit extraLuaPackages extraPython3Packages;
|
||||||
|
};
|
||||||
|
|
||||||
|
dummyInit = pkgs.writeText "nvf-init.lua" vimOptions.builtLuaConfigRC;
|
||||||
|
# Additional helper scripts for printing and displaying nvf configuration
|
||||||
|
# in your commandline.
|
||||||
|
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}";
|
||||||
|
printConfigPath = pkgs.writers.writeDashBin "nvf-print-config-path" "echo -n ${dummyInit}";
|
||||||
|
|
||||||
|
# Expose wrapped neovim-package for userspace
|
||||||
|
# or module consumption.
|
||||||
|
neovim = pkgs.symlinkJoin {
|
||||||
|
name = "nvf-with-helpers";
|
||||||
|
paths = [neovim-wrapped printConfig printConfigPath];
|
||||||
|
postBuild = "echo Helpers added";
|
||||||
|
|
||||||
|
# Allow evaluating vimOptions, i.e., config.vim from the packages' passthru
|
||||||
|
# attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig
|
||||||
|
# will return the configuration in full.
|
||||||
|
passthru.neovimConfig = vimOptions;
|
||||||
|
|
||||||
|
meta =
|
||||||
|
neovim-wrapped.meta
|
||||||
|
// {
|
||||||
|
description = "Wrapped Neovim package with helper scripts to print the config (path)";
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
config = {
|
config.vim.build = {
|
||||||
vim.startPlugins = map (x: x.package) (attrValues cfg.extraPlugins);
|
finalPackage = neovim;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./config.nix
|
|
||||||
./options.nix
|
./options.nix
|
||||||
|
./config.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,144 +1,12 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
pkgs,
|
inherit (lib.types) package;
|
||||||
lib,
|
inherit (lib.options) mkOption;
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
|
||||||
inherit (lib.types) package bool str listOf attrsOf;
|
|
||||||
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim.build = {
|
||||||
package = mkOption {
|
finalPackage = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = pkgs.neovim-unwrapped;
|
readOnly = true;
|
||||||
description = ''
|
description = "final output package";
|
||||||
The neovim package to use for the wrapper. This
|
|
||||||
corresponds to the package that will be wrapped
|
|
||||||
with your plugins and settings.
|
|
||||||
|
|
||||||
::: {.warning}
|
|
||||||
You will need to use an unwrapped package for this
|
|
||||||
option to work as intended. Using an already wrapped
|
|
||||||
package here may yield undesirable results.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
viAlias = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "Enable the `vi` alias for `nvim`";
|
|
||||||
};
|
|
||||||
|
|
||||||
vimAlias = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "Enable the `vim` alias for `nvim`";
|
|
||||||
};
|
|
||||||
|
|
||||||
startPlugins = pluginsOpt {
|
|
||||||
default = ["plenary-nvim"];
|
|
||||||
example = ''
|
|
||||||
[pkgs.vimPlugins.telescope-nvim]
|
|
||||||
'';
|
|
||||||
|
|
||||||
description = ''
|
|
||||||
List of plugins to load on startup. This is used
|
|
||||||
internally to add plugins to Neovim's runtime.
|
|
||||||
|
|
||||||
To add additional plugins to your configuration, consider
|
|
||||||
using the [{option}`vim.extraPlugins`](#opt-vim.extraPlugins)
|
|
||||||
option.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
optPlugins = pluginsOpt {
|
|
||||||
default = [];
|
|
||||||
example = ''
|
|
||||||
[pkgs.vimPlugins.vim-ghost]
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
List of plugins to optionally load on startup.
|
|
||||||
|
|
||||||
This option has the same type definition as {option}`vim.startPlugins`
|
|
||||||
and plugins in this list are appended to {option}`vim.startPlugins` by
|
|
||||||
the wrapper during the build process.
|
|
||||||
|
|
||||||
To avoid overriding packages and dependencies provided by startPlugins, you
|
|
||||||
are recommended to use this option or {option}`vim.extraPlugins` option.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraPlugins = mkOption {
|
|
||||||
type = attrsOf extraPluginType;
|
|
||||||
default = {};
|
|
||||||
description = ''
|
|
||||||
A list of plugins and their configurations that will be
|
|
||||||
set up after builtin plugins.
|
|
||||||
|
|
||||||
This option takes a special type that allows you to order
|
|
||||||
your custom plugins using nvf's modified DAG library.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = literalMD ''
|
|
||||||
```nix
|
|
||||||
with pkgs.vimPlugins; {
|
|
||||||
aerial = {
|
|
||||||
package = aerial-nvim;
|
|
||||||
setup = "require('aerial').setup {}";
|
|
||||||
};
|
|
||||||
|
|
||||||
harpoon = {
|
|
||||||
package = harpoon;
|
|
||||||
setup = "require('harpoon').setup {}";
|
|
||||||
after = ["aerial"]; # place harpoon configuration after aerial
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraPackages = mkOption {
|
|
||||||
type = listOf package;
|
|
||||||
default = [];
|
|
||||||
example = ''[pkgs.fzf pkgs.ripgrep]'';
|
|
||||||
description = ''
|
|
||||||
List of additional packages to make available to the Neovim
|
|
||||||
wrapper.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# this defaults to `true` in the wrapper
|
|
||||||
# and since we pass this value to the wrapper
|
|
||||||
# with an inherit, it should be `true` here as well
|
|
||||||
withRuby =
|
|
||||||
mkEnableOption ''
|
|
||||||
Ruby support in the Neovim wrapper.
|
|
||||||
''
|
|
||||||
// {
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
withNodeJs = mkEnableOption ''
|
|
||||||
NodeJs support in the Neovim wrapper
|
|
||||||
'';
|
|
||||||
|
|
||||||
luaPackages = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
example = ''["magick" "serpent"]'';
|
|
||||||
description = "List of lua packages to install";
|
|
||||||
};
|
|
||||||
|
|
||||||
withPython3 = mkEnableOption ''
|
|
||||||
Python3 support in the Neovim wrapper
|
|
||||||
'';
|
|
||||||
|
|
||||||
python3Packages = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
example = ''["pynvim"]'';
|
|
||||||
description = "List of python packages to install";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
13
modules/wrapper/environment/config.nix
Normal file
13
modules/wrapper/environment/config.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.attrsets) attrValues;
|
||||||
|
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
vim.startPlugins = map (x: x.package) (attrValues cfg.extraPlugins);
|
||||||
|
};
|
||||||
|
}
|
6
modules/wrapper/environment/default.nix
Normal file
6
modules/wrapper/environment/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./options.nix
|
||||||
|
];
|
||||||
|
}
|
144
modules/wrapper/environment/options.nix
Normal file
144
modules/wrapper/environment/options.nix
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||||
|
inherit (lib.types) package bool str listOf attrsOf;
|
||||||
|
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.neovim-unwrapped;
|
||||||
|
description = ''
|
||||||
|
The neovim package to use for the wrapper. This
|
||||||
|
corresponds to the package that will be wrapped
|
||||||
|
with your plugins and settings.
|
||||||
|
|
||||||
|
::: {.warning}
|
||||||
|
You will need to use an unwrapped package for this
|
||||||
|
option to work as intended. Using an already wrapped
|
||||||
|
package here may yield undesirable results.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
viAlias = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Enable the `vi` alias for `nvim`";
|
||||||
|
};
|
||||||
|
|
||||||
|
vimAlias = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Enable the `vim` alias for `nvim`";
|
||||||
|
};
|
||||||
|
|
||||||
|
startPlugins = pluginsOpt {
|
||||||
|
default = ["plenary-nvim"];
|
||||||
|
example = ''
|
||||||
|
[pkgs.vimPlugins.telescope-nvim]
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
List of plugins to load on startup. This is used
|
||||||
|
internally to add plugins to Neovim's runtime.
|
||||||
|
|
||||||
|
To add additional plugins to your configuration, consider
|
||||||
|
using the [{option}`vim.extraPlugins`](#opt-vim.extraPlugins)
|
||||||
|
option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
optPlugins = pluginsOpt {
|
||||||
|
default = [];
|
||||||
|
example = ''
|
||||||
|
[pkgs.vimPlugins.vim-ghost]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
List of plugins to optionally load on startup.
|
||||||
|
|
||||||
|
This option has the same type definition as {option}`vim.startPlugins`
|
||||||
|
and plugins in this list are appended to {option}`vim.startPlugins` by
|
||||||
|
the wrapper during the build process.
|
||||||
|
|
||||||
|
To avoid overriding packages and dependencies provided by startPlugins, you
|
||||||
|
are recommended to use this option or {option}`vim.extraPlugins` option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPlugins = mkOption {
|
||||||
|
type = attrsOf extraPluginType;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
A list of plugins and their configurations that will be
|
||||||
|
set up after builtin plugins.
|
||||||
|
|
||||||
|
This option takes a special type that allows you to order
|
||||||
|
your custom plugins using nvf's modified DAG library.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
|
with pkgs.vimPlugins; {
|
||||||
|
aerial = {
|
||||||
|
package = aerial-nvim;
|
||||||
|
setup = "require('aerial').setup {}";
|
||||||
|
};
|
||||||
|
|
||||||
|
harpoon = {
|
||||||
|
package = harpoon;
|
||||||
|
setup = "require('harpoon').setup {}";
|
||||||
|
after = ["aerial"]; # place harpoon configuration after aerial
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = listOf package;
|
||||||
|
default = [];
|
||||||
|
example = ''[pkgs.fzf pkgs.ripgrep]'';
|
||||||
|
description = ''
|
||||||
|
List of additional packages to make available to the Neovim
|
||||||
|
wrapper.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# this defaults to `true` in the wrapper
|
||||||
|
# and since we pass this value to the wrapper
|
||||||
|
# with an inherit, it should be `true` here as well
|
||||||
|
withRuby =
|
||||||
|
mkEnableOption ''
|
||||||
|
Ruby support in the Neovim wrapper.
|
||||||
|
''
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
withNodeJs = mkEnableOption ''
|
||||||
|
NodeJs support in the Neovim wrapper
|
||||||
|
'';
|
||||||
|
|
||||||
|
luaPackages = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = ''["magick" "serpent"]'';
|
||||||
|
description = "List of lua packages to install";
|
||||||
|
};
|
||||||
|
|
||||||
|
withPython3 = mkEnableOption ''
|
||||||
|
Python3 support in the Neovim wrapper
|
||||||
|
'';
|
||||||
|
|
||||||
|
python3Packages = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = ''["pynvim"]'';
|
||||||
|
description = "List of python packages to install";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue