anchor.diff:  , texinfo
   , hevea
   , buildDocs ? false
  +, optimize ? false # optimize sage to the current system (obviously impure)
   }:
   
   stdenv.mkDerivation rec {
  
positive.code:     mkdir -p "$doc"
      export SAGE_DOC="$doc"
      export SAGE_DOCBUILD_OPTS="--no-pdf-links -k"
    '';
  
    buildFlags = if (buildDocs) then "doc" else "build";
  
negative.code:   configureFlags = stdenv.lib.optionals(buildDocs) [ "--docdir=$(doc)" ];
    preConfigure = ''
      export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
  
      export HOME=/tmp/sage-home
      export SAGE_ROOT="$PWD"
  