From caf5c5e1cff698f73e55050bdd681f902b94a9da Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Wed, 22 May 2019 14:12:55 +0200 Subject: [PATCH] use recursive build inputs --- pkgs/nim-packages/generic.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/nim-packages/generic.nix b/pkgs/nim-packages/generic.nix index d44fe22..6cc0f5d 100644 --- a/pkgs/nim-packages/generic.nix +++ b/pkgs/nim-packages/generic.nix @@ -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