mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-06 00:51:05 +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:
parent
26d16c726d
commit
cbdfee5239
1 changed files with 3 additions and 13 deletions
|
|
@ -6,13 +6,13 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
builders = lib.nixvim.builders.withPkgs pkgs;
|
builders = lib.nixvim.builders.withPkgs pkgs;
|
||||||
|
byteCompileLua = with config.performance.byteCompileLua; enable && configs;
|
||||||
|
|
||||||
fileTypeModule =
|
fileTypeModule =
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
topConfig,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
|
@ -67,11 +67,7 @@ let
|
||||||
);
|
);
|
||||||
finalSource =
|
finalSource =
|
||||||
# Byte compile lua files if performance.byteCompileLua option is enabled
|
# Byte compile lua files if performance.byteCompileLua option is enabled
|
||||||
if
|
if byteCompileLua && lib.hasSuffix ".lua" config.target then
|
||||||
lib.hasSuffix ".lua" config.target
|
|
||||||
&& topConfig.performance.byteCompileLua.enable
|
|
||||||
&& topConfig.performance.byteCompileLua.configs
|
|
||||||
then
|
|
||||||
if lib.isDerivation config.source then
|
if lib.isDerivation config.source then
|
||||||
# Source is a derivation
|
# Source is a derivation
|
||||||
builders.byteCompileLuaDrv config.source
|
builders.byteCompileLuaDrv config.source
|
||||||
|
|
@ -82,17 +78,11 @@ let
|
||||||
config.source;
|
config.source;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fileType = lib.types.submoduleWith {
|
|
||||||
shorthandOnlyDefinesConfig = true;
|
|
||||||
modules = [ fileTypeModule ];
|
|
||||||
specialArgs.topConfig = config;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
extraFiles = lib.mkOption {
|
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";
|
description = "Extra files to add to the runtime path";
|
||||||
default = { };
|
default = { };
|
||||||
example = lib.literalExpression ''
|
example = lib.literalExpression ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue