From cbdfee52397efffedb5fb6cbb54b5b90b7f21ea6 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 3 Dec 2025 07:28:42 +0000 Subject: [PATCH] modules/files: simplify byteCompileLua condition Avoid needing a `specialArgs.topConfig` by binding `byteCompileLua` outside of the submodule scope. --- modules/files.nix | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/files.nix b/modules/files.nix index d4866a99..10c15dba 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -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 ''