 +                  'ENGINESDIR=$(OPENSSLDIR)/engines-{- $sover_dirname -}'
      '';
  
--    outputs = [ "bin" "dev" "out" "man" ] ++ optional withDocs "doc";
+-    outputs = [ "bin" "dev" "out" "man" ] ++ lib.optional withDocs "doc";
 +    outputs = [ "bin" "dev" "out" "man" ]
-+      ++ optional withDocs "doc"
++      ++ lib.optional withDocs "doc"
 +      # Separate output for the runtime dependencies of the static build.
-+      ++ optional static "etc";
++      ++ lib.optional static "etc";
      setOutputFlags = false;
      separateDebugInfo =
        !stdenv.hostPlatform.isDarwin &&
-@@ -101,7 +113,17 @@ let
+@@ -95,7 +107,17 @@ let
      configureFlags = [
        "shared" # "shared" builds both shared and static libraries
        "--libdir=lib"

     '' + lib.optionalString (!stdenv.hostPlatform.isWindows)
       # Fix bin/c_rehash's perl interpreter line
       #
@@ -152,14 +177,15 @@ let
       mv $out/include $dev/
 
       # remove dependency on Perl at runtime

     ] ++ lib.optionals withCryptodev [
       "-DHAVE_CRYPTODEV"
       "-DUSE_CRYPTODEV_DIGESTS"
@@ -126,6 +148,9 @@ let
       if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
           rm "$out/lib/"*.a
       fi
