diff --git a/pkgs/development/interpreters/lua-5/build-luarocks-package.nix b/pkgs/development/interpreters/lua-5/build-luarocks-package.nix index 3b49b60ca5d3..c388d0eef8c1 100644 --- a/pkgs/development/interpreters/lua-5/build-luarocks-package.nix +++ b/pkgs/development/interpreters/lua-5/build-luarocks-package.nix @@ -3,6 +3,7 @@ , lua , wrapLua , luarocks +, writeTextFile # Whether the derivation provides a lua module or not. , luarocksCheckHook @@ -83,7 +84,7 @@ let __structuredAttrs = true; env = { - LUAROCKS_CONFIG="$PWD/${luarocks_config}"; + LUAROCKS_CONFIG = self.configFile; } // attrs.env or {}; generatedRockspecFilename = "${rockspecDir}/${pname}-${rockspecVersion}.rockspec"; @@ -111,6 +112,12 @@ let # explicitly inherit this for it to be available as a shell variable in the # builder rocksSubdir = "${self.pname}-${self.version}-rocks"; + + configFile = writeTextFile { + name = pname + "-luarocks-config.lua"; + text = self.luarocks_content; + }; + luarocks_content = let externalDepsGenerated = lib.filter (drv: !drv ? luaModule) (self.nativeBuildInputs ++ self.propagatedBuildInputs ++ self.buildInputs); @@ -131,12 +138,6 @@ let configurePhase = '' runHook preConfigure - - cat > ${luarocks_config} <