I already have a derivation for a monorepo. In which shared libs are built and the folders are prepared for building the language specific packages. Hence the derivation for the subpackage needs to hijack the build directory of the main derivation. In this process encounter the following problem, namely that the shared libs are not available in the dynamic linking path for the subderivation (the python package needs access to them). I tried to fix it by adding the path of the libs to the ld lib path in the preBuild phase. This solved it for the derivation process but when using it isn’t available. What is the recommended way of doing/resolving this?
Here is the monorepo derivation:
{
lib,
stdenv,
fetchFromGitHub,
gperf,
jdk8,
jre8,
libxml2,
readline,
motif,
perl,
xorg,
which,
automake,
autoconf,
autoconf-archive,
python3,
git,
flex,
bison,
gfortran,
rsync,
pkg-config,
# xz, # is need according to them
# jdk, # maybe could work also just using the newest jdk
# libz, # we need zlib.h and it isn't included here
}:
stdenv.mkDerivation rec {
pname = "mdsplus";
version = "7-142-81";
src = fetchFromGitHub {
owner = "MDSplus";
repo = "mdsplus";
rev = "stable_release-${version}";
hash = "sha256-GV2Ry6NoYTpHWPKqgzK2TNo3BbX9OHdkFExCVIO5oEg=";
fetchSubmodules = true;
};
patchPhase = ''
patchShebangs --build .
'';
preConfigure = ''
./bootstrap
'';
buildInputs = [
gperf
jdk8
jre8
libxml2.dev
readline
motif
perl
xorg.libXt
# libz
];
nativeBuildInputs = [
which
automake
autoconf
autoconf-archive
python3
git
flex
bison
gfortran
rsync
pkg-config
];
# postBuild = ''
# '';
# postFixup = ''
# mkdir -p $out
# cp -r . $out
# '';
meta = {
description = "The MDSplus data management system";
homepage = "https://github.com/MDSplus/mdsplus";
# license = lib.licenses.unfree; # FIXME: nix-init did not find a license
maintainers = with lib.maintainers; [ ];
mainProgram = "mdsplus";
platforms = lib.platforms.all;
};
}
python subpackage derivation:
{
lib,
buildPythonPackage,
setuptools,
wheel,
numpy,
mdsplus,
}:
buildPythonPackage rec {
pname = "mdsplus";
version = "7-142-81";
format = "pyproject";
src = mdsplus;
nativeBuildInputs = [ mdsplus ];
buildInputs = [ mdsplus ];
preBuild = ''
export LD_LIBRARY_PATH=${mdsplus}/lib:$LD_LIBRARY_PATH
'';
dependencies = [
numpy
];
sourceRoot = "${src.name}/python/MDSplus/";
pythonImportsCheck = [
"MDSplus"
];
build-system = [setuptools wheel];
meta = {
description = "The MDSplus data management system";
homepage = "https://github.com/MDSplus/mdsplus/tree/alpha/python/MDSplus";
# license = lib.licenses.unfree; # FIXME: nix-init did not find a license
maintainers = with lib.maintainers; [ ];
mainProgram = "mdsplus";
platforms = lib.platforms.all;
};
}
Lastly is the help channel to correct place for this.