use recursive build inputs

This commit is contained in:
Christian Ulrich 2019-05-22 14:12:55 +02:00
parent 9e6e045e88
commit caf5c5e1cf
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 13 additions and 5 deletions

View File

@ -1,15 +1,23 @@
{ stdenv, nim }:
{ name, src, nimDeps ? [], buildInputs ? [], nativeBuildInputs ? [],
patches ? [], ... }:
{ name, src, nimDeps ? [], buildInputs ? [], patches ? [], patchPhase ? "", ... }:
let
getRecursiveBuildInputs = deps: with stdenv.lib.lists;
optionals (deps != []) ((head deps).buildInputs ++
(getRecursiveBuildInputs (head deps).nimDeps) ++
(getRecursiveBuildInputs (tail deps)));
recursiveBuildInputs = buildInputs ++ (getRecursiveBuildInputs nimDeps);
in
stdenv.mkDerivation {
name = name;
src = src;
patches = patches;
buildInputs = [ nim ] ++ buildInputs;
nativeBuildInputs = nativeBuildInputs;
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (buildInputs ++ nativeBuildInputs);
nativeBuildInputs = [ nim ];
buildInputs = recursiveBuildInputs;
nimDeps = nimDeps;
patchPhase = patchPhase;
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath recursiveBuildInputs;
buildPhase = ''
HOME=$TMPDIR
mkdir -p $HOME/.nimble/pkgs