anchor.diff:      # Sage installs during first `make`, `make install` is no-op and just takes time.
     '';
   
  -  outputs = [ "out" "doc" ];
  +  outputs = [ "out" ] ++ stdenv.lib.optionals (buildDocs) [ "doc" ];
   
     buildInputs = [
       bash # needed for the build
  
positive.code:   '';
  
    postBuild = ''
      rm -r "$out/sage-root/upstream" # don't keep the sources of all the spkgs
      rm -r "$out/sage-root/src/build"
      rm -rf "$out/sage-root/src/.git"
      rm -r "$out/sage-root/logs"
      # Fix dependency cycle between out and doc
      rm -f "$out/sage-root/config.log"
      rm -f "$out/sage-root/config.status"
  
negative.code:     # TODO could be patched with `sed s|printf(ctime(\(.*\)))|%s... or fixed upstream
    ];
  
    configureFlags = stdenv.lib.optionals(buildDocs) [ "--docdir=$(doc)" ];
    preConfigure = ''
      export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
      export SAGE_ATLAS_ARCH=fast
  
      export HOME=/tmp/sage-home
      export SAGE_ROOT="$PWD"
      export SAGE_SRC="$PWD"
  
      mkdir -p "$HOME"
      mkdir -p "$out"
  
      # we need to keep the source around
  