1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-05 16:41:06 +01:00

modules/files: simplify byteCompileLua condition

Avoid needing a `specialArgs.topConfig` by binding `byteCompileLua`
outside of the submodule scope.
This commit is contained in:
Matt Sturgeon 2025-12-03 07:28:42 +00:00 committed by Gaétan Lepage
parent 26d16c726d
commit cbdfee5239

View file

@ -6,13 +6,13 @@
}:
let
builders = lib.nixvim.builders.withPkgs pkgs;
byteCompileLua = with config.performance.byteCompileLua; enable && configs;
fileTypeModule =
{
name,
config,
options,
topConfig,
...
}:
{
@ -67,11 +67,7 @@ let
);
finalSource =
# Byte compile lua files if performance.byteCompileLua option is enabled
if
lib.hasSuffix ".lua" config.target
&& topConfig.performance.byteCompileLua.enable
&& topConfig.performance.byteCompileLua.configs
then
if byteCompileLua && lib.hasSuffix ".lua" config.target then
if lib.isDerivation config.source then
# Source is a derivation
builders.byteCompileLuaDrv config.source
@ -82,17 +78,11 @@ let
config.source;
};
};
fileType = lib.types.submoduleWith {
shorthandOnlyDefinesConfig = true;
modules = [ fileTypeModule ];
specialArgs.topConfig = config;
};
in
{
options = {
extraFiles = lib.mkOption {
type = lib.types.attrsOf fileType;
type = lib.types.attrsOf (lib.types.submodule fileTypeModule);
description = "Extra files to add to the runtime path";
default = { };
example = lib.literalExpression ''