Merge branch 'NotAShelf:main' into improve-terraformls

This commit is contained in:
ppenguin 2026-01-16 14:14:09 +01:00 committed by GitHub
commit 10fd334227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 673 additions and 366 deletions

View file

@ -24,8 +24,8 @@ it above in your description.
-->
[editorconfig]: https://editorconfig.org
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
[hacking nvf]: https://notashelf.github.io/nvf/index.xhtml#sec-guidelines
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/manual/release-notes
[hacking nvf]: https://nvf.notashelf.dev/hacking.html#sec-guidelines
- [ ] I have updated the [changelog] as per my changes
- [ ] I have tested, and self-reviewed my code

View file

@ -71,6 +71,7 @@ isMaximal: {
enable = isMaximal;
extensions.crates-nvim.enable = isMaximal;
};
toml.enable = isMaximal;
# Language modules that are not as common.
assembly.enable = false;

View file

@ -388,7 +388,7 @@ generated and opened by typing the following in a shell within a clone of the
$ nix build .#docs-html
# Open it with a valid browser
$ xdg-open $PWD/result/share/doc/nvf/index.html
$ xdg-open $PWD/result/share/doc/index.html
```
Additionally, if you are adding new links to the documentation it is **generally

View file

@ -22,11 +22,23 @@
Some other settings and commands are now deprecated but are still supported.
- The `setupOpts.mappings` options were also removed. Use the built-in
Neovim settings (nvf's {option}`vim.keymaps`)
- The `setupOpts.mappings` options were also removed. Use the built-in Neovim
settings (nvf's {option}`vim.keymaps`)
## Changelog {#sec-release-0-9-changelog}
[taylrfnt](https://github.com/taylrfnt)
- Introduce a `darwinModule` option for Darwin users. The ergonomics of
importing a `nixosModule` into a Darwin flake were less than ideal, and when
users fork and update npins, they are prone to encountering errors like the
following:
```shell
(class: "nixos") cannot be imported into a module
evaluation that expects class "darwin".
```
[suimong](https://github.com/suimong):
- Fix `vim.tabline.nvimBufferline` where `setupOpts.options.hover` requires
@ -65,7 +77,8 @@
[jtliang24](https://github.com/jtliang24):
- Updated nix language plugin to use pkgs.nixfmt instead of pkgs.nixfmt-rfc-style
- Updated nix language plugin to use pkgs.nixfmt instead of
pkgs.nixfmt-rfc-style
[alfarel](https://github.com/alfarelcynthesis):
@ -120,3 +133,22 @@
{command}`:healthcheck` doesn't know that.
- Remove [which-key.nvim] `<leader>o` `+Notes` description which did not
actually correspond to any keybinds.
[pyrox0](https://github.com/pyrox0):
- Added [rumdl](https://github.com/rvben/rumdl) support to `languages.markdown`
- Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql`
- Added [Pyrefly](https://pyrefly.org/) support to `languages.python`
- Added TOML support via {option}`languages.toml` and the
[Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and
formatter.
- Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as
`visuals.hlargs-nvim`.
[Machshev](https://github.com/machshev):
- Added `ruff` and `ty` LSP support for Python under `programs.python`.

25
flake.lock generated
View file

@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1760948891,
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
"lastModified": 1768135262,
"narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
"rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
"type": "github"
},
"original": {
@ -38,11 +38,11 @@
},
"mnw": {
"locked": {
"lastModified": 1758834834,
"narHash": "sha256-Y7IvY4F8vajZyp3WGf+KaiIVwondEkMFkt92Cr9NZmg=",
"lastModified": 1767030222,
"narHash": "sha256-kSvWF3Xt2HW9hmV5V7i8PqeWJIBUKmuKoHhOgj3Znzs=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "cfbc7d1cc832e318d0863a5fc91d940a96034001",
"rev": "75bb637454b0fbbb5ed652375a4bf7ffd28bcf6f",
"type": "github"
},
"original": {
@ -58,26 +58,27 @@
]
},
"locked": {
"lastModified": 1765720983,
"narHash": "sha256-tWtukpABmux6EC/FuCJEgA1kmRjcRPtED44N+GGPq+4=",
"lastModified": 1768214250,
"narHash": "sha256-hnBZDQWUxJV3KbtvyGW5BKLO/fAwydrxm5WHCWMQTbw=",
"owner": "feel-co",
"repo": "ndg",
"rev": "f399ace8bb8e1f705dd8942b24d207aa4d75c936",
"rev": "a6bd3c1ce2668d096e4fdaaa03ad7f03ba1fbca8",
"type": "github"
},
"original": {
"owner": "feel-co",
"ref": "refs/tags/v2.6.0",
"repo": "ndg",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1767364772,
"narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
"lastModified": 1768395095,
"narHash": "sha256-ZhuYJbwbZT32QA95tSkXd9zXHcdZj90EzHpEXBMabaw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
"rev": "13868c071cc73a5e9f610c47d7bb08e5da64fdd5",
"type": "github"
},
"original": {

View file

@ -53,6 +53,11 @@
''
self.nixosModules.nvf;
};
darwinModules = {
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
default = self.darwinModules.nvf;
};
};
perSystem = {pkgs, ...}: {
@ -86,16 +91,27 @@
# Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check`
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
alejandra --check ${self} < /dev/null
nix-fmt =
pkgs.runCommand "nix-fmt-check"
{
src = self;
nativeBuildInputs = [pkgs.alejandra pkgs.fd];
} ''
cd "$src"
fd -t f -e nix -x alejandra --check '{}'
touch $out
'';
# Check if Markdown sources are properly formatted
# This can be initiated with `nix build .#checks.<system>.md-fmt`
# or with `nix flake check`
md-fmt = pkgs.runCommand "md-fmt-check" {nativeBuildInputs = [pkgs.deno];} ''
deno fmt --check ${self} --ext md
md-fmt =
pkgs.runCommand "md-fmt-check" {
src = self;
nativeBuildInputs = [pkgs.deno pkgs.fd];
} ''
cd "$src"
fd -t f -e md -x deno fmt --check '{}'
touch $out
'';
};
@ -123,7 +139,7 @@
# Alternative documentation generator
ndg = {
url = "github:feel-co/ndg";
url = "github:feel-co/ndg?ref=refs/tags/v2.6.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};

View file

@ -38,6 +38,7 @@ in {
./svelte.nix
./tailwind.nix
./terraform.nix
./toml.nix
./ts.nix
./typst.nix
./zig.nix

View file

@ -31,6 +31,13 @@
filetypes = ["markdown"];
root_markers = [".git" ".obsidian" ".moxide.toml"];
};
rumdl = {
enable = true;
cmd = [(getExe pkgs.rumdl) "server"];
filetypes = ["markdown"];
root_markers = [".git" ".rumdl.toml" "rumdl.toml" ".config/rumdl.toml" "pyproject.toml"];
};
};
defaultFormat = ["deno_fmt"];
@ -42,6 +49,9 @@
deno_fmt = {
command = getExe pkgs.deno;
};
rumdl = {
command = getExe pkgs.rumdl;
};
prettierd = {
command = getExe pkgs.prettierd;
};
@ -51,6 +61,9 @@
markdownlint-cli2 = {
package = pkgs.markdownlint-cli2;
};
rumdl = {
package = pkgs.rumdl;
};
};
in {
options.vim.languages.markdown = {

View file

@ -20,6 +20,21 @@
defaultServers = ["basedpyright"];
servers = {
pyrefly = {
enable = true;
cmd = [(getExe pkgs.pyrefly) "server"];
filetypes = ["python"];
root_markers = [
"pyproject.toml"
"pyrefly.toml"
"setup.py"
"setup.cfg"
"requirements.txt"
"Pipfile"
".git"
];
};
pyright = {
enable = true;
cmd = [(getExe' pkgs.pyright "pyright-langserver") "--stdio"];
@ -126,6 +141,34 @@
".git"
];
};
ruff = {
enable = true;
cmd = [(getExe pkgs.ruff) "server"];
filetypes = ["python"];
root_markers = [
"pyproject.toml"
"setup.py"
"setup.cfg"
"requirements.txt"
"Pipfile"
".git"
];
};
ty = {
enable = true;
cmd = [(getExe pkgs.ty) "server"];
filetypes = ["python"];
root_markers = [
"pyproject.toml"
"setup.py"
"setup.cfg"
"requirements.txt"
"Pipfile"
".git"
];
};
};
defaultFormat = ["black"];

View file

@ -15,6 +15,7 @@
cfg = config.vim.languages.sql;
sqlfluffDefault = pkgs.sqlfluff;
sqruffDefault = pkgs.sqruff;
defaultServers = ["sqls"];
servers = {
@ -39,6 +40,10 @@
command = getExe sqlfluffDefault;
append_args = ["--dialect=${cfg.dialect}"];
};
sqruff = {
command = getExe sqruffDefault;
append_args = ["--dialect=${cfg.dialect}"];
};
};
defaultDiagnosticsProvider = ["sqlfluff"];
@ -50,6 +55,13 @@
args = ["lint" "--format=json" "--dialect=${cfg.dialect}"];
};
};
sqruff = {
package = sqruffDefault;
config = {
cmd = getExe sqruffDefault;
args = ["lint" "--format=json" "--dialect=${cfg.dialect}" "-"];
};
};
};
in {
options.vim.languages.sql = {
@ -58,7 +70,7 @@ in {
dialect = mkOption {
type = str;
default = "ansi";
description = "SQL dialect for sqlfluff (if used)";
description = "SQL dialect for formatters and diagnostics (if used)";
};
treesitter = {

View file

@ -0,0 +1,151 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool enum;
inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.toml;
defaultServers = ["tombi"];
servers = {
tombi = {
enable = true;
cmd = [
(getExe pkgs.tombi)
"lsp"
];
filetypes = ["toml"];
root_markers = [
"tombi.toml"
".git"
];
};
};
defaultFormat = ["tombi"];
formats = {
tombi = {
command = getExe pkgs.tombi;
args = [
"format"
"--stdin-filepath"
"$FILENAME"
"-"
];
};
};
defaultDiagnosticsProvider = ["tombi"];
diagnosticsProviders = {
tombi = {
package = pkgs.tombi;
args = ["lint"];
};
};
in {
options.vim.languages.toml = {
enable = mkEnableOption "TOML configuration language support";
treesitter = {
enable =
mkEnableOption "TOML treesitter"
// {
default = config.vim.languages.enableTreesitter;
};
package = mkGrammarOption pkgs "toml";
};
lsp = {
enable =
mkEnableOption "TOML LSP support"
// {
default = config.vim.lsp.enable;
};
servers = mkOption {
description = "TOML LSP server to use";
type = deprecatedSingleOrListOf "vim.language.toml.lsp.servers" (enum (attrNames servers));
default = defaultServers;
};
};
format = {
enable =
mkEnableOption "TOML formatting"
// {
default = config.vim.languages.enableFormat;
};
type = mkOption {
type = deprecatedSingleOrListOf "vim.language.toml.format.type" (enum (attrNames formats));
default = defaultFormat;
description = "TOML formatter to use.";
};
};
extraDiagnostics = {
enable =
mkEnableOption "extra TOML diagnostics"
// {
default = config.vim.languages.enableExtraDiagnostics;
};
types = diagnostics {
langDesc = "TOML";
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.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft.toml = cfg.format.type;
formatters =
mapListToAttrs (name: {
inherit name;
value = formats.${name};
})
cfg.format.type;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.toml = cfg.extraDiagnostics.types;
linters = mkMerge (
map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types
);
};
})
]);
}

View file

@ -11,6 +11,7 @@ in {
./cinnamon-nvim
./fidget-nvim
./highlight-undo
./hlargs-nvim
./indent-blankline
./nvim-cursorline
./nvim-scrollbar

View file

@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.visuals.hlargs-nvim;
in {
vim = mkIf cfg.enable {
startPlugins = ["hlargs-nvim"];
pluginRC.hlargs-nvim = entryAnywhere ''
require('hlargs').setup(${toLuaObject cfg.setupOpts})
'';
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./hlargs-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.visuals.hlargs-nvim = {
enable = mkEnableOption "hlargs-nvim";
setupOpts = mkPluginSetupOption "hlargs-nvim" {};
};
}

View file

@ -11,17 +11,6 @@
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
noBuildPlug = pname: let
pin = getPin pname;
version = builtins.substring 0 8 pin.revision;
in
pin.outPath.overrideAttrs {
inherit pname version;
name = "${pname}-${version}";
passthru.vimPlugin = false;
};
# Build a Vim plugin with the given name and arguments.
buildPlug = attrs: let
pin = getPin attrs.pname;
@ -49,7 +38,7 @@
# Checkhealth fails to get the plugin's commit and therefore to
# show the rest of the useful diagnostics if not built like this.
obsidian-nvim = pkgs.vimUtils.buildVimPlugin {
# If set to `"obsidian-nvim"`, this breaks like `buildPlug` and `noBuildPlug`.
# If set to `"obsidian-nvim"`, this breaks like `buildPlug` and .
name = "obsidian.nvim";
src = getPin "obsidian-nvim";
nvimSkipModules = [
@ -80,7 +69,7 @@
if (lib.isType "flake" plugin)
then plugin // {name = plug;}
else plugin)
else pluginBuilders.${plug} or (noBuildPlug plug)
else pluginBuilders.${plug} or (getPin plug)
else plug) (
filter (f: f != null) plugins
);

File diff suppressed because it is too large Load diff

View file

@ -6,78 +6,14 @@
}:
builtins.mapAttrs
(
name: let
getUrl = {
url,
hash,
...
}:
fetchurl {
inherit url;
sha256 = hash;
};
getZip = {
url,
hash,
...
}:
fetchzip {
inherit url;
sha256 = hash;
extension = "tar";
};
mkGitSource = {
repository,
revision,
url ? null,
submodules,
hash,
...
} @ attrs:
assert repository ? type;
if url != null && !submodules
then getZip attrs
else
assert repository.type == "Git"; let
url' =
if repository.type == "Git"
then repository.url
else if repository.type == "GitHub"
then "https://github.com/${repository.owner}/${repository.repo}.git"
else if repository.type == "GitLab"
then "${repository.server}/${repository.repo_path}.git"
else throw "Unrecognized repository type ${repository.type}";
name = let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url';
short = builtins.substring 0 7 revision;
appendShort =
if (builtins.match "[a-f0-9]*" revision) != null
then "-${short}"
else "";
in "${
if matched == null
then "source"
else builtins.head matched
}${appendShort}";
in
fetchgit {
inherit name;
url = url';
rev = revision;
sha256 = hash;
fetchSubmodules = submodules;
};
in
spec:
assert spec ? type; let
mayOverride = path: let
name: spec: let
mayOverride = name: path: let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = lib.stringAsChars (c:
if (builtins.match "[a-zA-Z0-9]" c) == null
then "_"
else c)
name;
saneName = builtins.concatStringsSep "_" (
builtins.concatLists (
builtins.filter (x: builtins.isList x && x != [""]) (builtins.split "([a-zA-Z0-9]*)" name)
)
);
ersatz = builtins.getEnv envVarName;
in
if ersatz == ""
@ -90,25 +26,90 @@ builtins.mapAttrs
then /. + ersatz
else /. + builtins.getEnv "PWD" + "/${ersatz}"
);
func =
path =
rec {
GitRelease = Git;
Channel = Tarball;
Git =
if spec.url != null && !spec.submodules
then Tarball
else
fetchgit (
let
repo = spec.repository;
url =
{
Git = mkGitSource;
GitRelease = mkGitSource;
PyPi = getUrl;
Channel = getZip;
Tarball = getUrl;
Git = repo.url;
GitHub = "https://github.com/${repo.owner}/${repo.repo}.git";
GitLab = "${repo.server}/${repo.repo_path}.git";
Forgejo = "${repo.server}/${repo.owner}/${repo.repo}.git";
}
.${
repo.type
} or (throw "Unrecognized repository type ${repo.type}");
in {
name = let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url;
appendShort =
if (builtins.match "[a-f0-9]*" spec.revision) != null
then "-${builtins.substring 0 7 spec.revision}"
else "";
in "${
if matched == null
then "source"
else builtins.head matched
}${appendShort}";
inherit url;
rev = spec.revision;
inherit (spec) hash;
fetchSubmodules = spec.submodules;
}
);
PyPi = fetchurl {
inherit (spec) url hash;
};
Tarball = fetchzip {
inherit (spec) url hash;
extension = "tar";
};
}
.${
spec.type
}
or (builtins.throw "Unknown source type ${spec.type}");
} or (builtins.throw "Unknown source type ${spec.type}");
version =
if spec ? revision
then builtins.substring 0 8 spec.revision
else "0";
in
spec // {outPath = mayOverride (func spec);}
spec
// {
name = "${name}-${version}";
pname = name;
inherit version;
outPath =
(
# Override logic won't do anything if we're in pure eval
if builtins ? currentSystem
then mayOverride name path
else path
).overrideAttrs
{
pname = name;
name = "${name}-${version}";
inherit version;
};
}
)
(
let
json = lib.importJSON ./sources.json;
in
assert lib.assertMsg (json.version == 5) "Npins version mismatch!";
assert lib.assertMsg (json.version == 7) "Unsupported format version ${toString json.version} in sources.json. Try running `npins upgrade`";
json.pins
)