mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lsp/nil_ls: refactor options
This commit is contained in:
parent
f7e009d29e
commit
513b3c76e2
1 changed files with 53 additions and 28 deletions
|
@ -1,13 +1,19 @@
|
||||||
{ lib, helpers }:
|
{ lib, helpers }:
|
||||||
# Options:
|
# All available settings are documented here:
|
||||||
# - https://github.com/oxalica/nil/blob/main/docs/configuration.md?plain=1#
|
# https://github.com/oxalica/nil/blob/main/docs/configuration.md
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
formatting = {
|
formatting = {
|
||||||
command = helpers.defaultNullOpts.mkListOf types.str null ''
|
command = helpers.defaultNullOpts.mkListOf' {
|
||||||
External formatter command (with arguments).
|
type = types.str;
|
||||||
It should accepts file content in stdin and print the formatted code into stdout.
|
default = null;
|
||||||
|
description = ''
|
||||||
|
External formatting command, complete with required arguments.
|
||||||
|
|
||||||
|
It should accept file content from stdin and print the formatted code to stdout.
|
||||||
'';
|
'';
|
||||||
|
example = [ "nixpkgs-fmt" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
|
@ -17,26 +23,40 @@ with lib;
|
||||||
with the diagnostic message.
|
with the diagnostic message.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
excludedFiles = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
excludedFiles = helpers.defaultNullOpts.mkListOf' {
|
||||||
|
type = types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
Files to exclude from showing diagnostics. Useful for generated files.
|
Files to exclude from showing diagnostics. Useful for generated files.
|
||||||
|
|
||||||
It accepts an array of paths. Relative paths are joint to the workspace root.
|
It accepts an array of paths. Relative paths are joint to the workspace root.
|
||||||
Glob patterns are currently not supported.
|
Glob patterns are currently not supported.
|
||||||
'';
|
'';
|
||||||
|
example = [ "Cargo.nix" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
binary = helpers.defaultNullOpts.mkStr "nix" ''
|
binary = helpers.defaultNullOpts.mkStr' {
|
||||||
The path to the `nix` binary.
|
default = "nix";
|
||||||
'';
|
description = "The path to the `nix` binary.";
|
||||||
|
example = "/run/current-system/sw/bin/nix";
|
||||||
|
};
|
||||||
|
|
||||||
maxMemoryMB = helpers.defaultNullOpts.mkInt 2560 ''
|
maxMemoryMB = helpers.defaultNullOpts.mkUnsignedInt' {
|
||||||
|
default = 2560;
|
||||||
|
example = 1024;
|
||||||
|
description = ''
|
||||||
The heap memory limit in MiB for `nix` evaluation.
|
The heap memory limit in MiB for `nix` evaluation.
|
||||||
|
|
||||||
Currently it only applies to flake evaluation when `autoEvalInputs` is enabled, and only works
|
Currently it only applies to flake evaluation when `autoEvalInputs` is enabled, and only works
|
||||||
for Linux.
|
for Linux.
|
||||||
Other `nix` invocations may be also applied in the future.
|
Other `nix` invocations may be also applied in the future.
|
||||||
`null` means no limit.
|
`null` means no limit.
|
||||||
|
|
||||||
As a reference, `nix flake show --legacy nixpkgs` usually requires about 2GiB memory.
|
As a reference, `nix flake show --legacy nixpkgs` usually requires about 2GiB memory.
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
autoArchive = helpers.defaultNullOpts.mkBool false ''
|
autoArchive = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
@ -51,13 +71,18 @@ with lib;
|
||||||
The evaluation result is used to improve completion, but may cost lots of time and/or memory.
|
The evaluation result is used to improve completion, but may cost lots of time and/or memory.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nixpkgsInputName = helpers.defaultNullOpts.mkStr "nixpkgs" ''
|
nixpkgsInputName = helpers.defaultNullOpts.mkStr' {
|
||||||
|
default = "nixpkgs";
|
||||||
|
example = "nixos";
|
||||||
|
description = ''
|
||||||
The input name of nixpkgs for NixOS options evaluation.
|
The input name of nixpkgs for NixOS options evaluation.
|
||||||
|
|
||||||
The options hierarchy is used to improve completion, but may cost lots of time and/or memory.
|
The options hierarchy is used to improve completion, but may cost lots of time and/or memory.
|
||||||
|
|
||||||
If this value is `null` or is not found in the workspace flake's inputs, NixOS options are
|
If this value is `null` or is not found in the workspace flake's inputs, NixOS options are
|
||||||
not evaluated.
|
not evaluated.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue