diff options
author | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-11-24 00:08:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 00:08:45 +0100 |
commit | e03c9c3f1be4994c63b27ce60d41f13ebfeb3cad (patch) | |
tree | 990754cea28b55ac3a0f8400a9e61812d528cd12 /pkgs/development/interpreters/lua-5 | |
parent | 40de5938426b06886a2b441142031c29e0eb8dc1 (diff) |
buildLuarocksPackage: save luarocks config as derivation (#269402)
* buildLuarocksPackage: save luarocks config as derivation while debugging luarocks packages, it's exhausting to have to build them, look at what random folder they've been built to finally look for their config. With this you can run nix build lua51Packages.plenary-nvim.configFile -f . and infer what luarocks will do. * Update pkgs/development/interpreters/lua-5/build-luarocks-package.nix Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com> --------- Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
Diffstat (limited to 'pkgs/development/interpreters/lua-5')
-rw-r--r-- | pkgs/development/interpreters/lua-5/build-luarocks-package.nix | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pkgs/development/interpreters/lua-5/build-luarocks-package.nix b/pkgs/development/interpreters/lua-5/build-luarocks-package.nix index 3b49b60ca5d33..c388d0eef8c1d 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} <<EOF - ${self.luarocks_content} - EOF - export LUAROCKS_CONFIG="$PWD/${luarocks_config}"; - cat "$LUAROCKS_CONFIG" '' + lib.optionalString (self.rockspecFilename == null) '' rockspecFilename="${self.generatedRockspecFilename}" |