diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 3f45a795586c..2f6f5e51c0e8 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -249,7 +249,11 @@ stdenv.mkDerivation ({ configureFlags+=" --extra-lib-dirs=$p/lib" fi done - '' + (optionalString stdenv.isDarwin '' + '' + # only use the links hack if we're actually building dylibs. otherwise, the + # "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes + # "ln -s $out/lib/links", which tries to recreate the links dir and fails + + (optionalString (stdenv.isDarwin && enableSharedLibraries) '' # Work around a limit in the macOS Sierra linker on the number of paths # referenced by any one dynamic library: #