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>
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user