anchor.diff:  
       sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \
          $out/share/openmpi/mpic++-wrapper-data.txt
  +  '' + lib.optionalString fortranSupport ''
   
       sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:'  \
          $out/share/openmpi/mpifort-wrapper-data.txt
  
positive.code:     find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \;
    '';
  
    buildInputs = with stdenv; [ gfortran zlib ]
      ++ lib.optionals isLinux [ libnl numactl pmix ucx ]
      ++ lib.optionals cudaSupport [ cudatoolkit ]
      ++ [ libevent hwloc ]
      ++ lib.optional (isLinux || isFreeBSD) rdma-core
      ++ lib.optional fabricSupport [ libpsm2 libfabric ];
  
    nativeBuildInputs = [ perl ];
  
    configureFlags = with stdenv; lib.optional (!cudaSupport) "--disable-mca-dso"
      ++ lib.optionals isLinux  [
        "--with-libnl=${libnl.dev}"
        "--with-pmix=${pmix}"
        "--with-pmix-libdir=${pmix}/lib"
  
negative.code: 
  # Enable libfabric support (necessary for Omnipath networks) on x86_64 linux
  , fabricSupport ? stdenv.isLinux && stdenv.isx86_64
  
  # Enable Fortran support
  , fortranSupport ? !(stdenv.isDarwin && stdenv.isAarch64)
  }:
  
  assert !cudaSupport || cudatoolkit != null;
  
  let
    cudatoolkit_joined = symlinkJoin {
      name = "${cudatoolkit.name}-unsplit";
      paths = [ cudatoolkit.out cudatoolkit.lib ];
    };
  in stdenv.mkDerivation rec {
    pname = "openmpi";
    version = "4.1.1";
  
    src = with lib.versions; fetchurl {
      url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
  