Compare commits

...

6 commits

Author SHA1 Message Date
diniamo
83508e1010
Merge 55cdd6db48 into c957b23aaa 2024-09-27 15:35:42 +01:00
Anthony
c957b23aaa
docs: fix dead links in CONTRIBUTING + put PR template in its appropriate location (#384) 2024-09-26 18:07:04 +03:00
Gerg-L
b4c06c71dc
docs: fix declerations (#381)
* docs: fix declerations

* fix: formatting for your baldness
2024-09-26 01:46:47 +03:00
a56a83bd46
flake: bump neo-tree 2024-09-26 00:29:52 +03:00
diniamo
55cdd6db48 configuration: enable nu for maximal 2024-09-14 18:38:46 +02:00
diniamo
cb0f831efd modules/languages: add nu 2024-09-14 18:38:46 +02:00
8 changed files with 148 additions and 9 deletions

View file

@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [
## Contributing
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
### Guidelines

View file

@ -71,6 +71,7 @@ isMaximal: {
enable = isMaximal;
crates.enable = isMaximal;
};
nu.enable = isMaximal;
};
visuals = {

View file

@ -74,7 +74,7 @@
(lib.removePrefix (toString ../.))
(lib.removePrefix "/")
(x: {
url = "https://github.com/NotAShelf/nvf/blob/main/${decl}";
url = "https://github.com/NotAShelf/nvf/blob/main/${x}";
name = "<nvf/${x}>";
})
]

View file

@ -863,11 +863,11 @@
"plugin-neo-tree-nvim": {
"flake": false,
"locked": {
"lastModified": 1713050882,
"narHash": "sha256-cZwOVpdMT0NCtp6Ha592QA2RzKVS6LhXXcjfDBCQ+0k=",
"lastModified": 1726542367,
"narHash": "sha256-Lqt0KJNT9HmpJwZoWChYeVBrDWhscRe8COqVCwgcTwk=",
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"rev": "22e566aeb075c94f670f34077e05ba95190dfb4a",
"rev": "a77af2e764c5ed4038d27d1c463fa49cd4794e07",
"type": "github"
},
"original": {

View file

@ -8,7 +8,7 @@
# The core neovim modules.
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: "${./neovim}/${p}") [
neovim = map (p: ./neovim + "/${p}") [
"init"
"mappings"
];
@ -16,7 +16,7 @@
# Individual plugin modules, separated by the type of plugin.
# While adding a new type, you must make sure your type is
# included in the list below.
plugins = map (p: "${./plugins}/${p}") [
plugins = map (p: ./plugins + "/${p}") [
"assistant"
"autopairs"
"comments"
@ -46,7 +46,7 @@
# The neovim wrapper, used to build a wrapped neovim package
# using the configuration passed in `neovim` and `plugins` modules.
wrapper = map (p: "${./wrapper}/${p}") [
wrapper = map (p: ./wrapper + "/${p}") [
"build"
"rc"
"warnings"
@ -54,7 +54,7 @@
# Extra modules, such as deprecation warnings
# or renames in one place.
extra = map (p: "${./extra}/${p}") [
extra = map (p: ./extra + "/${p}") [
"deprecations.nix"
];
in

View file

@ -26,6 +26,7 @@ in {
./ts.nix
./typst.nix
./zig.nix
./nu.nix
];
options.vim.languages = {

View file

@ -0,0 +1,137 @@
{
lib,
pkgs,
config,
...
}: let
inherit (lib.options) mkEnableOption mkOption mkPackageOption;
inherit (lib.types) str either package listOf enum;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.lua) expToLua;
inherit (pkgs) fetchFromGitHub;
inherit (builtins) attrNames isList;
defaultServer = "nushell";
servers = {
nushell = {
package = pkgs.nushell;
lspConfig = ''
lspconfig.nushell.setup{
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/nu", "--no-config-file", "--lsp"}''
}
}
'';
};
};
# FIX: uncomment formatting parts, once https://github.com/NixOS/nixpkgs/pull/341647 makes it into nixos-unstable
# defaultFormat = "nufmt";
# formats = {
# nufmt = {
# package = pkgs.nufmt.overrideAttrs {
# src = fetchFromGitHub {
# owner = "nushell";
# repo = "nufmt";
# rev = "63549df4406216cce7e744576b1ee8fcaba9a30a";
# hash = "sha256-Y7LvsCuirhYPjuQSF0w7me8vYrV39i4OhVvyI3XskpE=";
# };
# };
# nullConfig = ''
# table.insert(
# ls_sources,
# {
# name = "nufmt",
# method = null_methods.internal.FORMATTING,
# filetypes = { "nu" },
# generator_opts = {
# command = "${cfg.format.package}/bin/nufmt",
# args = { "--stdin" },
# to_stdin = true
# },
# factory = null_helpers.formatter_factory
# }
# )
# '';
# };
# };
cfg = config.vim.languages.nu;
in {
options.vim.languages.nu = {
enable = mkEnableOption "Nu language support";
treesitter = {
enable = mkEnableOption "Nu treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkOption {
description = "The Nu treesitter package to use.";
type = package;
# FIX: this doesn't work, unofficial grammars probably need some extra lua code
default = pkgs.tree-sitter.buildGrammar {
language = "nu";
version = "0.0.0+rev=0bb9a60";
src = fetchFromGitHub {
owner = "nushell";
repo = "tree-sitter-nu";
rev = "0bb9a602d9bc94b66fab96ce51d46a5a227ab76c";
hash = "sha256-A5GiOpITOv3H0wytCv6t43buQ8IzxEXrk3gTlOrO0K0=";
};
meta.homepage = "https://github.com/nushell/tree-sitter-nu";
};
defaultText = "See code";
};
};
lsp = {
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Nu LSP server to use";
type = str;
default = defaultServer;
};
package = mkOption {
description = "Nu LSP server package, or the command to run as a list of strings";
example = ''[(lib.getExe pkgs.nushell) "--lsp"]'';
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
# format = {
# enable = mkEnableOption "Nu formatting" // {default = config.vim.languages.enableFormat;};
#
# type = mkOption {
# description = "Nu formatter to use";
# type = enum (attrNames formats);
# default = defaultFormat;
# };
# package = mkOption {
# description = "Nu formatter package";
# type = package;
# default = formats.${cfg.format.type}.package;
# };
# };
};
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.nu-lsp = servers.${cfg.lsp.server}.lspConfig;
})
# (mkIf cfg.format.enable {
# vim.lsp.null-ls.enable = true;
# vim.lsp.null-ls.sources.nu-format = formats.${cfg.format.type}.nullConfig;
# })
]);
}