anchor.diff:      sha256 = "04vy3qyakikslc58qyv8c9qrwlivix3w6znc993i37cvfg99dch9";
     };
   
  -  nativeBuildInputs = [ blas gfortran gfortran.cc.lib lapack python ];
  +  nativeBuildInputs = [ python gfortran gfortran.cc.lib ];
  +  buildInputs = [ blas lapack ]
  +    ++ lib.optional mpiSupport mpi
  +    ++ lib.optional (mpiSupport && mpi == openmpi) openssh
  +    ++ lib.optional withp4est p4est
  +  ;
   
     # Upstream does some hot she-py-bang stuff, this change streamlines that
     # process. The original script in upstream is both a shell script and a
  
positive.code: { lib, stdenv , darwin , fetchurl , blas , gfortran , lapack , python }:
  
  stdenv.mkDerivation rec {
    pname = "petsc";
    version = "3.14.2";
  
negative.code:     patchShebangs .
      configureFlagsArray=(
        $configureFlagsArray
        ${if !mpiSupport then ''
          "--CC=$CC"
          "--with-cxx=$CXX"
          "--with-fc=$FC"
          "--with-mpi=0"
        '' else ''
          "--CC=mpicc"
          "--with-cxx=mpicxx"
          "--with-fc=mpif90"
          "--with-mpi=1"
        ''}
        ${if withp4est then ''
          "--with-p4est=1"
          "--with-zlib-include=${zlib.dev}/include"
          "--with-zlib-lib=-L${zlib}/lib -lz"
        '' else ""}
        "--with-blas-lib=[${blas}/lib/libblas.so,${gfortran.cc.lib}/lib/libgfortran.a]"
        "--with-lapack-lib=[${lapack}/lib/liblapack.so,${gfortran.cc.lib}/lib/libgfortran.a]"
      )
    '';
  
    inherit mpiSupport withp4est;
    enableParallelBuilding = true;
    doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
  
    meta = with lib; {
      description = "Linear algebra algorithms for solving partial differential equations";
      homepage = "https://www.mcs.anl.gov/petsc/index.html";
      license = licenses.bsd2;
      maintainers = with maintainers; [ wucke13 cburstedde ];
    };
  }
  