anchor.diff:      for entry in $out/bin/mpichversion $out/bin/mpivars; do
         echo "fix rpath: $entry"
         patchelf --set-rpath "$out/lib" $entry
  +    done
  +  '';
  +
  +  # Make OpenSSH available, which is required for mpirun_rsh.
  +  # Enables hybrid parallelisation scheme by default.
  +  postFixup = ''
  +    for exe in $out/bin/*; do
  +      wrapProgram $exe\
  +        --prefix PATH : "${openssh}/bin" \
  +        --set-default MV2_ENABLE_AFFINITY "0"
       done
     '';
   
  
positive.code: { lib, stdenv, fetchurl, pkgconfig, bison, numactl, libxml2
  , perl, gfortran, slurm, openssh, hwloc, rdma-core
  , infiniband-diags, opensm, zlib
  # Compile with slurm as a process manager
  , useSlurm ? false
  } :
  
  let
  
  
negative.code:   ];
  
  
    nativeBuildInputs = [ pkgconfig bison makeWrapper ];
    propagatedBuildInputs = [ numactl rdma-core zlib infiniband-diags opensm ];
    buildInputs = [
      numactl
      libxml2
      perl
      gfortran
      slurm
      openssh
      hwloc
      rdma-core
      infiniband-diags
      opensm
      libpsm2
      libfabric
    ];
  
    configureFlags = [
      "--with-pm=hydra"
      "--enable-fortran=all"
      "--enable-cxx"
      "--enable-threads=multiple"
      "--enable-hybrid"
      "--enable-shared"
    ] ++ lib.optionals useSlurm [ "--with-pmi=pmi1" "--with-pm=slurm" ]
      ++ lib.optional (network == "ethernet") "--with-device=ch3:sock"
      ++ lib.optionals (network == "infiniband") [ "--with-device=ch3:mrail" "--with-rdma=gen2" ]
      ++ lib.optionals (network == "omnipath") ["--with-device=ch3:psm" "--with-psm2=${libpsm2}"]
    ;
  
    doCheck = true;
  
  