I am trying to build the libraries and documentation for the lua binaries. To do this you download two tar files and then extract and build them. Problem I am having is that I cannot work out how to make Nix find the file in the directory. I have the two tar.gz files in the same directory as the derivation, but when I try to tar/unpack the files the derivation fails because the file is not in the directory in which the derivation is being built - which makes sense. I have tried copying the file into $out, have tried hard coding the names of the two tar files - all to no avail. My derivation is as follows:
{
pkgs,
stdenv,
...
}:
let
project-name = "lua5_4_2"; # Name of derivation
version = "5.4.2"; # Version of the file
lua_doc = "./lua-${version}_Docs_html.tar.gz"; # Documentation for LUA
lua_source = "./lua-${version}_Sources.tar.gz"; # Source code to build LUA
in
stdenv.mkDerivation rec
{
name = "${project-name}"; # Name of the derivation
srcs =
[
lua_doc
lua_source
];
unpackPhase =
''
runHook preUnpack
for s in $srcs
do
tar --extract --file=$s
done
runHook postUnpack
'';
configurePhase =
''
runHook preConfigure
#
#Now we need to replace hard coded paths, etc, from the make file so that
#it works correctly with Nix.
#
substituteInPlace Makefile \
--replace /usr/local $out \
--replace 'PLAT= guess' 'PLAT=linux'
#
#Now we need to create the output directory.
#
mkdir --parents $out
runHook postConfigure
'';
buildPhase =
''
runHook preBuild
make
runHook postBuild
'';
installPhase =
''
runHook preInstall
#
#Now we need to install the software.
#
make install
#
#Now we need to create the directory to store the library in.
#
cd $out/lib
#
#As the IUP module requires a versioned 'liblua' library and neither NixOS
#or LUA BINARIES provide it, we must perform the task ourselves. The
#below version must match the value of LUA_SUFFIX as defined in the IUP
#derivations.
#
ln --symbolic --verbose liblua.a liblua54.a
runHook postInstall
'';
}
I have searched the forum but could not find any answers that worked for me. Is it possible to do what I need to do ? Any help would be appreciated as I have spent hours trying to solve this one.
Thanking you for your time.