Skip to content

Commit cbdfee5

Browse files
MattSturgeonGaetanLepage
authored andcommitted
modules/files: simplify byteCompileLua condition
Avoid needing a `specialArgs.topConfig` by binding `byteCompileLua` outside of the submodule scope.
1 parent 26d16c7 commit cbdfee5

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

modules/files.nix

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
}:
77
let
88
builders = lib.nixvim.builders.withPkgs pkgs;
9+
byteCompileLua = with config.performance.byteCompileLua; enable && configs;
910

1011
fileTypeModule =
1112
{
1213
name,
1314
config,
1415
options,
15-
topConfig,
1616
...
1717
}:
1818
{
@@ -67,11 +67,7 @@ let
6767
);
6868
finalSource =
6969
# Byte compile lua files if performance.byteCompileLua option is enabled
70-
if
71-
lib.hasSuffix ".lua" config.target
72-
&& topConfig.performance.byteCompileLua.enable
73-
&& topConfig.performance.byteCompileLua.configs
74-
then
70+
if byteCompileLua && lib.hasSuffix ".lua" config.target then
7571
if lib.isDerivation config.source then
7672
# Source is a derivation
7773
builders.byteCompileLuaDrv config.source
@@ -82,17 +78,11 @@ let
8278
config.source;
8379
};
8480
};
85-
86-
fileType = lib.types.submoduleWith {
87-
shorthandOnlyDefinesConfig = true;
88-
modules = [ fileTypeModule ];
89-
specialArgs.topConfig = config;
90-
};
9181
in
9282
{
9383
options = {
9484
extraFiles = lib.mkOption {
95-
type = lib.types.attrsOf fileType;
85+
type = lib.types.attrsOf (lib.types.submodule fileTypeModule);
9686
description = "Extra files to add to the runtime path";
9787
default = { };
9888
example = lib.literalExpression ''

0 commit comments

Comments
 (0)