mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/nix-develop: migrate to mkNeovimPlugin
This commit is contained in:
parent
6c30476a4d
commit
bfb08c1ab7
2 changed files with 59 additions and 53 deletions
|
@ -1,60 +1,66 @@
|
||||||
{
|
{ lib, ... }:
|
||||||
lib,
|
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.nix-develop;
|
inherit (lib) types;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts toLuaObject;
|
||||||
in
|
in
|
||||||
{
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
options.plugins.nix-develop = lib.nixvim.neovim-plugin.extraOptionsOptions // {
|
name = "nix-develop";
|
||||||
enable = mkEnableOption "nix-develop.nvim";
|
packPathName = "nix-develop.nvim";
|
||||||
|
package = "nix-develop-nvim";
|
||||||
|
callSetup = false;
|
||||||
|
hasSettings = false;
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "nix-develop.nvim" {
|
maintainers = [ lib.maintainers.HeitorAugustoLN ];
|
||||||
default = [
|
|
||||||
"vimPlugins"
|
|
||||||
"nix-develop-nvim"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
ignoredVariables = mkOption {
|
extraOptions = {
|
||||||
type = with types; attrsOf bool;
|
ignoredVariables =
|
||||||
default = { };
|
defaultNullOpts.mkAttrsOf types.bool
|
||||||
description = "An attrs specifying the variables should be ignored.";
|
{
|
||||||
example = {
|
|
||||||
BASHOPTS = true;
|
BASHOPTS = true;
|
||||||
HOME = true;
|
HOME = true;
|
||||||
NIX_BUILD_TOP = true;
|
NIX_BUILD_TOP = true;
|
||||||
|
NIX_ENFORCE_PURITY = true;
|
||||||
|
NIX_LOG_FD = true;
|
||||||
|
NIX_REMOTE = true;
|
||||||
|
PPID = true;
|
||||||
SHELL = true;
|
SHELL = true;
|
||||||
|
SHELLOPTS = true;
|
||||||
|
SSL_CERT_FILE = true;
|
||||||
|
TEMP = true;
|
||||||
|
TEMPDIR = true;
|
||||||
|
TERM = true;
|
||||||
TMP = true;
|
TMP = true;
|
||||||
};
|
TMPDIR = true;
|
||||||
};
|
TZ = true;
|
||||||
|
UID = true;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
Variables that should be ignored when generating the environment.
|
||||||
|
'';
|
||||||
|
|
||||||
separatedVariables = mkOption {
|
separatedVariables =
|
||||||
type = with types; attrsOf str;
|
defaultNullOpts.mkAttrsOf types.str
|
||||||
default = { };
|
{
|
||||||
description = "An attrs specifying the separator to use for particular environment variables.";
|
|
||||||
example = {
|
|
||||||
PATH = ":";
|
PATH = ":";
|
||||||
XDG_DATA_DIRS = ":";
|
XDG_DATA_DIRS = ":";
|
||||||
};
|
}
|
||||||
};
|
''
|
||||||
|
Specified separators to use for particular environment variables.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
extraConfig = cfg: {
|
||||||
extraPlugins = [ cfg.package ];
|
plugins.nix-develop.luaConfig.content =
|
||||||
extraConfigLua = ''
|
lib.optionalString (cfg.ignoredVariables != null) ''
|
||||||
local __ignored_variables = ${lib.nixvim.toLuaObject cfg.ignoredVariables}
|
local ignored_variables = ${toLuaObject cfg.ignoredVariables}
|
||||||
for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do
|
for ignored_variable, should_ignore in pairs(ignored_variables) do
|
||||||
require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore
|
require("nix-develop").ignored_variables[ignored_variable] = should_ignore
|
||||||
end
|
end
|
||||||
|
''
|
||||||
local __separated_variables = ${lib.nixvim.toLuaObject cfg.separatedVariables}
|
+ lib.optionalString (cfg.separatedVariables != null) ''
|
||||||
for variable, separator in ipairs(__separated_variables) do
|
local separated_variables = ${toLuaObject cfg.separatedVariables}
|
||||||
require("nix-develop").separated_variables[variable] = separator
|
for separated_variable, separator in pairs(separated_variables) do
|
||||||
|
require("nix-develop").separated_variables[separated_variable] = separator
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
HOME = true;
|
HOME = true;
|
||||||
};
|
};
|
||||||
separatedVariables = {
|
separatedVariables = {
|
||||||
"LUA_PATH" = ":";
|
LUA_PATH = ":";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue