anchor.diff:      homepage    = "https://pytorch.org/";
       license     = lib.licenses.bsd3;
       platforms   = with lib.platforms; linux ++ lib.optionals (!cudaSupport) darwin;
  -    maintainers = with lib.maintainers; [ teh thoughtpolice stites tscholak ]; # tscholak esp. for darwin-related builds
  +    maintainers = with lib.maintainers; [ teh thoughtpolice tscholak ]; # tscholak esp. for darwin-related builds
     };
   }
  
positive.code:     click
      numpy
      pyyaml
    ] ++ lib.optionals openMPISupport [ openmpi ]
      ++ lib.optional (pythonOlder "3.5") typing
      ++ lib.optionals tensorboardSupport [pillow six future tensorflow-tensorboard];
  
    checkInputs = [ hypothesis ninja ];
  
    doCheck = false; # tests take a long time for channel release, so doCheck should be overridden only when developing
    checkPhase = "${cudaStubEnv}python test/run_test.py"
      + " --exclude utils" # utils requires git, which is not allowed in the check phase
  
      # Other tests which have been disabled in previous nix derivations of pytorch.
      # --exclude dataloader sparse torch utils thd_distributed distributed cpp_extensions
      ;
    postInstall = ''
      mkdir $dev
      cp -r $out/${python.sitePackages}/torch/lib     $dev/lib
      cp -r $out/${python.sitePackages}/torch/include $dev/include
    '';
  
    postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
  
negative.code: { stdenv, fetchurl, fetchgit, fetchpatch, buildPythonPackage, python, pythonOlder,
    cudaSupport ? false, cudatoolkit ? null, cudnn ? null, nccl ? null, magma ? null,
    mklDnnSupport ? true, useSystemNccl ? true,
    openMPISupport ? false, openmpi ? null,
    buildBinaries ? false,
    buildDocs ? false,
    cudaArchList ? null,
    fetchFromGitHub, lib, numpy, pyyaml, cffi, click, typing, cmake, hypothesis, numactl, psutil,
    linkFarm, symlinkJoin,
  
    # virtual pkg that consistently instantiates blas across nixpkgs
    # See https://github.com/NixOS/nixpkgs/pull/83888
    blas,
  
    # ninja (https://ninja-build.org) must be available to run C++ extensions tests,
    ninja,
  
    # dependencies for torch.utils.tensorboard
    pillow, six, future, tensorflow-tensorboard, protobuf,
  
    utillinux, which, isPy3k }:
  
  assert !openMPISupport || openmpi != null;
  
  # assert that everything needed for cuda is present and that the correct cuda versions are used
  assert !cudaSupport || cudatoolkit != null;
  