mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-01-19 08:22:25 +00:00
Merge branch 'main' into feat-blink
This commit is contained in:
commit
618a1bd737
8 changed files with 273 additions and 19 deletions
|
@ -80,6 +80,7 @@ isMaximal: {
|
||||||
ocaml.enable = false;
|
ocaml.enable = false;
|
||||||
elixir.enable = false;
|
elixir.enable = false;
|
||||||
haskell.enable = false;
|
haskell.enable = false;
|
||||||
|
ruby.enable = false;
|
||||||
|
|
||||||
tailwind.enable = false;
|
tailwind.enable = false;
|
||||||
svelte.enable = false;
|
svelte.enable = false;
|
||||||
|
|
|
@ -14,14 +14,11 @@ necessarily) before you start developing.
|
||||||
|
|
||||||
## Adding Documentation {#sec-guidelines-documentation}
|
## Adding Documentation {#sec-guidelines-documentation}
|
||||||
|
|
||||||
Most, if not all, changes warrant changes to the documentation. Module options
|
[Nixpkgs Flavoured Markdown]: https://github.com/NixOS/nixpkgs/blob/master/doc/README.md#syntax
|
||||||
should be documented with
|
|
||||||
[Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup),
|
|
||||||
albeit with exceptions.
|
|
||||||
|
|
||||||
::: {.note} As of **v0.5**, **nvf** is itself documented using full markdown in
|
Almost all changes warrant updates to the documentation: at the very least, you
|
||||||
both module options and the manual. With **v0.6**, this manual has also been
|
must update the changelog. Both the manual and module options use
|
||||||
converted to markdown in full. :::
|
[Nixpkgs Flavoured Markdown].
|
||||||
|
|
||||||
The HTML version of this manual containing both the module option descriptions
|
The HTML version of this manual containing both the module option descriptions
|
||||||
and the documentation of **nvf** (such as this page) can be generated and opened
|
and the documentation of **nvf** (such as this page) can be generated and opened
|
||||||
|
@ -117,10 +114,11 @@ applies to string literals and module descriptions and documentation.
|
||||||
|
|
||||||
### Nix {#sec-code-style-nix}
|
### Nix {#sec-code-style-nix}
|
||||||
|
|
||||||
**nvf** is formatted by the
|
[alejandra]: https://github.com/kamadorueda/alejandra
|
||||||
[alejandra](https://github.com/kamadorueda/alejandra) tool and the formatting is
|
|
||||||
checked in the pull request and push workflows. Run the `nix fmt` command inside
|
**nvf** is formatted by the [alejandra] tool and the formatting is checked in
|
||||||
the project repository before submitting your pull request.
|
the pull request and push workflows. Run the `nix fmt` command inside the
|
||||||
|
project repository before submitting your pull request.
|
||||||
|
|
||||||
While Alejandra is mostly opinionated on how code looks after formatting,
|
While Alejandra is mostly opinionated on how code looks after formatting,
|
||||||
certain changes are done at the user's discretion based on how the original code
|
certain changes are done at the user's discretion based on how the original code
|
||||||
|
@ -138,10 +136,14 @@ module = {
|
||||||
# same as parent modules, unfold submodules
|
# same as parent modules, unfold submodules
|
||||||
subModule = {
|
subModule = {
|
||||||
# this is an option that contains more than one nested value
|
# this is an option that contains more than one nested value
|
||||||
|
# Note: try to be careful about the ordering of `mkOption` arguments.
|
||||||
|
# General rule of thumb is to order from least to most likely to change.
|
||||||
|
# This is, for most cases, type < default < description.
|
||||||
|
# Example, if present, would be between default and description
|
||||||
someOtherValue = mkOption {
|
someOtherValue = mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
description = "Some other description";
|
|
||||||
default = true;
|
default = true;
|
||||||
|
description = "Some other description";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,15 @@
|
||||||
|
|
||||||
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
||||||
issue with setting the workspace directory.
|
issue with setting the workspace directory.
|
||||||
|
- Add `vim.snippets.luasnip.setupOpts`, which was previously missing.
|
||||||
- Add `"prettierd"` as a formatter option in `vim.languages.markdown.format.type`.
|
- Add `"prettierd"` as a formatter option in `vim.languages.markdown.format.type`.
|
||||||
|
|
||||||
|
[kaktu5](https://github.com/kaktu5):
|
||||||
|
|
||||||
|
- Add WGSL support under `vim.languages.wgsl`.
|
||||||
|
|
||||||
|
[tomasguinzburg](https://github.com/tomasguinzburg):
|
||||||
|
|
||||||
|
[solargraph]: https://github.com/castwide/solargraph
|
||||||
|
|
||||||
|
- Add Ruby support under `vim.languages.ruby` using [solargraph].
|
||||||
|
|
|
@ -38,6 +38,8 @@ in {
|
||||||
./julia.nix
|
./julia.nix
|
||||||
./nu.nix
|
./nu.nix
|
||||||
./odin.nix
|
./odin.nix
|
||||||
|
./wgsl.nix
|
||||||
|
./ruby.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages = {
|
options.vim.languages = {
|
||||||
|
|
152
modules/plugins/languages/ruby.nix
Normal file
152
modules/plugins/languages/ruby.nix
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
inherit (lib.types) either listOf package str enum;
|
||||||
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.ruby;
|
||||||
|
|
||||||
|
defaultServer = "rubyserver";
|
||||||
|
servers = {
|
||||||
|
rubyserver = {
|
||||||
|
package = pkgs.rubyPackages.solargraph;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.solargraph.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = attach_keymaps,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
cmd = { "${pkgs.solargraph}/bin/solargraph", "stdio" }
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# testing
|
||||||
|
|
||||||
|
defaultFormat = "rubocop";
|
||||||
|
formats = {
|
||||||
|
rubocop = {
|
||||||
|
package = pkgs.rubyPackages.rubocop;
|
||||||
|
nullConfig = ''
|
||||||
|
local conditional = function(fn)
|
||||||
|
local utils = require("null-ls.utils").make_conditional_utils()
|
||||||
|
return fn(utils)
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.rubocop.with({
|
||||||
|
command="${pkgs.bundler}/bin/bundle",
|
||||||
|
args = vim.list_extend(
|
||||||
|
{"exec", "rubocop", "-a" },
|
||||||
|
null_ls.builtins.formatting.rubocop._opts.args
|
||||||
|
),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["rubocop"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
rubocop = {
|
||||||
|
package = pkgs.rubyPackages.rubocop;
|
||||||
|
nullConfig = pkg: ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.diagnostics.rubocop.with({
|
||||||
|
command = "${lib.getExe pkg}",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.ruby = {
|
||||||
|
enable = mkEnableOption "Ruby language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Ruby treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "ruby";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Ruby LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
description = "Ruby LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
description = "Ruby LSP server package, or the command to run as a list of strings";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Ruby formatter support" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "Ruby formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "Ruby formatter package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "Ruby extra diagnostics support"
|
||||||
|
// {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Ruby";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.ruby-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||||
|
lang = "ruby";
|
||||||
|
config = cfg.extraDiagnostics.types;
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
79
modules/plugins/languages/wgsl.nix
Normal file
79
modules/plugins/languages/wgsl.nix
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) either enum listOf package str;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.wgsl;
|
||||||
|
|
||||||
|
defaultServer = "wgsl-analyzer";
|
||||||
|
servers = {
|
||||||
|
wgsl-analyzer = {
|
||||||
|
package = pkgs.wgsl-analyzer;
|
||||||
|
internalFormatter = true;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.wgsl_analyzer.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else "{'${cfg.lsp.package}/bin/wgsl_analyzer'}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.wgsl = {
|
||||||
|
enable = mkEnableOption "WGSL language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "WGSL treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "wgsl";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "WGSL LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
description = "WGSL LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "wgsl-analyzer package, or the command to run as a list of strings";
|
||||||
|
example = literalExpression "[(lib.getExe pkgs.wgsl-analyzer)]";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = pkgs.wgsl-analyzer;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter = {
|
||||||
|
enable = true;
|
||||||
|
grammars = [cfg.treesitter.package];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim = {
|
||||||
|
lsp.lspconfig = {
|
||||||
|
enable = true;
|
||||||
|
sources.wgsl_analyzer = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -9,13 +9,16 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
lazy.plugins = {
|
lazy.plugins.luasnip = {
|
||||||
luasnip = {
|
|
||||||
package = "luasnip";
|
package = "luasnip";
|
||||||
|
|
||||||
lazy = true;
|
lazy = true;
|
||||||
|
|
||||||
|
setupModule = "luasnip";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
after = cfg.loaders;
|
after = cfg.loaders;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
startPlugins = cfg.providers;
|
startPlugins = cfg.providers;
|
||||||
autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
|
autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
|
||||||
sources = {luasnip = "[LuaSnip]";};
|
sources = {luasnip = "[LuaSnip]";};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||||
inherit (lib.types) listOf lines;
|
inherit (lib.types) listOf lines;
|
||||||
inherit (lib.nvim.types) pluginType;
|
inherit (lib.nvim.types) pluginType mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.snippets.luasnip = {
|
options.vim.snippets.luasnip = {
|
||||||
enable = mkEnableOption "luasnip";
|
enable = mkEnableOption "luasnip";
|
||||||
|
@ -32,5 +32,9 @@ in {
|
||||||
```
|
```
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "LuaSnip" {
|
||||||
|
enable_autosnippets = mkEnableOption "autosnippets";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue