mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 17:28:39 +02:00
plugins/nix-develop: init + tests (#644)
This commit is contained in:
parent
465d09849a
commit
0ece949f98
3 changed files with 61 additions and 0 deletions
|
@ -120,6 +120,7 @@
|
||||||
./utils/neogen.nix
|
./utils/neogen.nix
|
||||||
./utils/notify.nix
|
./utils/notify.nix
|
||||||
./utils/netman.nix
|
./utils/netman.nix
|
||||||
|
./utils/nix-develop.nix
|
||||||
./utils/nvim-autopairs.nix
|
./utils/nvim-autopairs.nix
|
||||||
./utils/nvim-bqf.nix
|
./utils/nvim-bqf.nix
|
||||||
./utils/nvim-colorizer.nix
|
./utils/nvim-colorizer.nix
|
||||||
|
|
43
plugins/utils/nix-develop.nix
Normal file
43
plugins/utils/nix-develop.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.nix-develop;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
|
options.plugins.nix-develop =
|
||||||
|
helpers.extraOptionsOptions
|
||||||
|
// {
|
||||||
|
enable = mkEnableOption "nix-develop.nvim";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "nix-develop.nvim" pkgs.vimPlugins.nix-develop-nvim;
|
||||||
|
|
||||||
|
ignoredVariables = mkOption {
|
||||||
|
type = types.attrsOf types.bool;
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
separatedVariables = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
extraConfigLua = ''
|
||||||
|
local __ignored_variables = ${helpers.toLuaObject cfg.ignoredVariables}
|
||||||
|
for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do
|
||||||
|
require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore
|
||||||
|
end
|
||||||
|
|
||||||
|
local __separated_variables = ${helpers.toLuaObject cfg.separatedVariables}
|
||||||
|
for variable, separator in ipairs(__separated_variables) do
|
||||||
|
require("nix-develop").separated_variables[variable] = separator
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
17
tests/test-sources/plugins/utils/nix-develop.nix
Normal file
17
tests/test-sources/plugins/utils/nix-develop.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.nix-develop.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins.nix-develop = {
|
||||||
|
enable = true;
|
||||||
|
ignoredVariables = {
|
||||||
|
HOME = true;
|
||||||
|
};
|
||||||
|
separatedVariables = {
|
||||||
|
"LUA_PATH" = ":";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue