anchor.diff: -{ lib, stdenv , darwin , fetchurl , blas , gfortran , lapack , python }:
  +{ lib
  +, stdenv
  +, fetchurl
  +, darwin
  +, gfortran
  +, python
  +, blas
  +, lapack
  +, mpi                   # generic mpi dependency
  +, openmpi               # to compare against mpi
  +, openssh               # required for openmpi tests
  +, petsc-withp4est ? true
  +, p4est
  +, zlib                  # propagated by p4est but required by petsc
  +}:
   
  +let
  +  mpiSupport = !withp4est || p4est.mpiSupport;
  +  withp4est = petsc-withp4est;
  +in
   stdenv.mkDerivation rec {
     pname = "petsc";
     version = "3.14.2";
  
positive.code:     patchShebangs .
      configureFlagsArray=(
        $configureFlagsArray
        "--CC=$CC"
        "--with-cxx=$CXX"
        "--with-fc=$FC"
        "--with-mpi=0"
        "--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]"
      )
    '';
  
    meta = with lib; {
      description = ''
        Library of linear algebra algorithms for solving partial differential
        equations
      '';
      homepage = "https://www.mcs.anl.gov/petsc/index.html";
      license = licenses.bsd2;
      maintainers = with maintainers; [ wucke13 ];
      platforms = platforms.all;
    };
  }
  
negative.code:     sha256 = "04vy3qyakikslc58qyv8c9qrwlivix3w6znc993i37cvfg99dch9";
    };
  
    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
  