diff --git a/pkgs/nim-packages/generic.nix b/pkgs/nim-packages/generic.nix index 6cc0f5d..9fffa84 100644 --- a/pkgs/nim-packages/generic.nix +++ b/pkgs/nim-packages/generic.nix @@ -1,23 +1,29 @@ { stdenv, nim }: -{ name, src, nimDeps ? [], buildInputs ? [], patches ? [], patchPhase ? "", ... }: +{ name, src, nimDeps ? [], nativeBuildInputs ? [], buildInputs ? [], + patches ? [], patchPhase ? "", ... }: + +with stdenv.lib; let - getRecursiveBuildInputs = deps: with stdenv.lib.lists; - optionals (deps != []) ((head deps).buildInputs ++ - (getRecursiveBuildInputs (head deps).nimDeps) ++ - (getRecursiveBuildInputs (tail deps))); - recursiveBuildInputs = buildInputs ++ (getRecursiveBuildInputs nimDeps); + getRecursiveInputs = getInputsFn: deps: + optionals (deps != []) ((getInputsFn (head deps)) ++ + (getRecursiveInputs getInputsFn (head deps).nimDeps) ++ + (getRecursiveInputs getInputsFn (tail deps))); + rNativeBuildInputs = + nativeBuildInputs ++ (getRecursiveInputs (i: i.nativeBuildInputs) nimDeps); + rBuildInputs = + buildInputs ++ (getRecursiveInputs (i: i.buildInputs) nimDeps); in stdenv.mkDerivation { name = name; src = src; patches = patches; - nativeBuildInputs = [ nim ]; - buildInputs = recursiveBuildInputs; + nativeBuildInputs = [ nim ] ++ (filter (i: i != nim) rNativeBuildInputs); + buildInputs = rBuildInputs; nimDeps = nimDeps; patchPhase = patchPhase; - LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath recursiveBuildInputs; + LD_LIBRARY_PATH = makeLibraryPath (rBuildInputs ++ rNativeBuildInputs); buildPhase = '' HOME=$TMPDIR mkdir -p $HOME/.nimble/pkgs diff --git a/pkgs/nim-packages/ui.nix b/pkgs/nim-packages/ui.nix index 3032748..dd908d7 100644 --- a/pkgs/nim-packages/ui.nix +++ b/pkgs/nim-packages/ui.nix @@ -18,7 +18,9 @@ buildNimblePackage rec { rm ui/libui/darwin/OLD_table.m ''; - buildInputs = [ pkg-config gtk3 ]; + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ gtk3 ]; meta = with stdenv.lib; { description = "Beginnings of what might become Nim's official UI library";