plugins/rest: add dependencies

https://github.com/rest-nvim/rest.nvim?tab=readme-ov-file#dependencies
This commit is contained in:
Austin Horstman 2024-09-09 17:08:12 -05:00
parent 6c9d178ecc
commit b7dea12375
No known key found for this signature in database
2 changed files with 103 additions and 94 deletions

View file

@ -1,4 +1,5 @@
{ {
config,
lib, lib,
helpers, helpers,
pkgs, pkgs,
@ -401,21 +402,33 @@ helpers.neovim-plugin.mkNeovimPlugin {
}; };
extraOptions = { extraOptions = {
curlPackage = lib.mkPackageOption pkgs "curl" {
nullable = true;
};
enableHttpFiletypeAssociation = lib.mkOption { enableHttpFiletypeAssociation = lib.mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = '' description = ''
Sets up the filetype association of `.http` files to trigger treesitter support. Sets up the filetype association of `.http` files to trigger treesitter support to enable `rest` functionality.
''; '';
}; };
}; };
extraConfig = cfg: { extraConfig = cfg: {
assertions = [
{
assertion = config.plugins.treesitter.enable;
message = ''
Nixvim (plugins.rest): Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`.
'';
}
];
extraPackages = [ cfg.curlPackage ];
filetype = lib.mkIf cfg.enableHttpFiletypeAssociation { filetype = lib.mkIf cfg.enableHttpFiletypeAssociation {
extension = { extension.http = "http";
"http" = "http";
};
}; };
}; };
} }

View file

@ -1,20 +1,15 @@
{ {
empty = { empty = {
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to plugins = {
# the vim plugin. rest.enable = true;
# TODO: re-enable this test when this issue will have been fixed treesitter.enable = true;
test.runNvim = false; };
plugins.rest.enable = true;
}; };
defaults = { defaults = {
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to plugins = {
# the vim plugin. treesitter.enable = true;
# TODO: re-enable this test when this issue will have been fixed rest = {
test.runNvim = false;
plugins.rest = {
enable = true; enable = true;
settings = { settings = {
@ -104,4 +99,5 @@
}; };
}; };
}; };
};
} }