mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 18:29:47 +01:00
Similarly to extraPytonPackages, we add extraLuaPackages that make lua libraries available at runtime.
This commit is contained in:
parent
50204cea94
commit
a3c18a60d5
2 changed files with 35 additions and 1 deletions
|
@ -16,6 +16,17 @@ let
|
|||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
# Currently, upstream Neovim is pinned on Lua 5.1 for LuaJIT support.
|
||||
# This will need to be updated if Neovim ever migrates to a newer
|
||||
# version of Lua.
|
||||
extraLua51PackageType = mkOptionType {
|
||||
name = "extra-lua51-packages";
|
||||
description = "lua5.1 packages in lua5_1.withPackages format";
|
||||
check = with types;
|
||||
(x: if isFunction x then isList (x pkgs.lua51Packages) else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
config = mkOption {
|
||||
|
@ -67,6 +78,16 @@ let
|
|||
|
||||
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ])
|
||||
''--suffix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
||||
extraMakeWrapperLuaCArgs = lib.optionalString (cfg.extraLuaPackages != [ ]) ''
|
||||
--suffix LUA_CPATH ";" "${
|
||||
lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaCPath
|
||||
cfg.extraLuaPackages
|
||||
}"'';
|
||||
extraMakeWrapperLuaArgs = lib.optionalString (cfg.extraLuaPackages != [ ]) ''
|
||||
--suffix LUA_PATH ";" "${
|
||||
lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaPath
|
||||
cfg.extraLuaPackages
|
||||
}"'';
|
||||
|
||||
in {
|
||||
imports = [
|
||||
|
@ -141,6 +162,17 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
extraLuaPackages = mkOption {
|
||||
type = with types; either extraLua51PackageType (listOf package);
|
||||
default = [ ];
|
||||
defaultText = "[]";
|
||||
example = literalExpression "(ps: with ps; [ luautf8 ])";
|
||||
description = ''
|
||||
A function in lua5_1.withPackages format, which returns a
|
||||
list of Lua packages required for your plugins to work.
|
||||
'';
|
||||
};
|
||||
|
||||
generatedConfigViml = mkOption {
|
||||
type = types.lines;
|
||||
visible = true;
|
||||
|
@ -353,7 +385,8 @@ in {
|
|||
programs.neovim.finalPackage = pkgs.wrapNeovimUnstable cfg.package
|
||||
(neovimConfig // {
|
||||
wrapperArgs = (lib.escapeShellArgs neovimConfig.wrapperArgs) + " "
|
||||
+ extraMakeWrapperArgs;
|
||||
+ extraMakeWrapperArgs + " " + extraMakeWrapperLuaCArgs + " "
|
||||
+ extraMakeWrapperLuaArgs;
|
||||
wrapRc = false;
|
||||
});
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ with lib;
|
|||
'';
|
||||
}
|
||||
];
|
||||
extraLuaPackages = [ pkgs.lua51Packages.luautf8 ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
|
|
Loading…
Reference in a new issue