mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 15:13:46 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
{ stdenv
|
|
, sage-with-env
|
|
, python3
|
|
, jupyter-kernel-specs
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
version = src.version;
|
|
pname = "sagedoc";
|
|
src = sage-with-env.env.lib.src;
|
|
|
|
strictDeps = true;
|
|
|
|
unpackPhase = ''
|
|
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
|
|
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
|
|
|
|
cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
|
|
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
|
|
'';
|
|
|
|
buildPhase = ''
|
|
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
|
|
export HOME="$TMPDIR/sage_home"
|
|
mkdir -p "$HOME"
|
|
|
|
# needed to link them in the sage docs using intersphinx
|
|
export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
|
|
|
|
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
|
|
export JUPYTER_PATH=${jupyter-kernel-specs}
|
|
|
|
${sage-with-env}/bin/sage --docbuild \
|
|
--mathjax \
|
|
--no-pdf-links \
|
|
all html
|
|
'';
|
|
|
|
installPhase = ''
|
|
cd "$SAGE_DOC_OVERRIDE"
|
|
|
|
mkdir -p "$out/share/doc/sage"
|
|
cp -r html "$out"/share/doc/sage
|
|
|
|
# Replace duplicated files by symlinks (Gentoo)
|
|
cd "$out"/share/doc/sage
|
|
mv html/en/_static{,.tmp}
|
|
for _dir in `find -name _static` ; do
|
|
rm -r $_dir
|
|
ln -rs html/en/_static $_dir
|
|
done
|
|
mv html/en/_static{.tmp,}
|
|
'';
|
|
|
|
doCheck = true;
|
|
checkPhase = ''
|
|
# sagemath_doc_html tests assume sage tests are being run, so we
|
|
# compromise: we run standard tests, but only on files containing
|
|
# relevant tests. as of Sage 9.6, there are only 4 such files.
|
|
grep -PRl "#.*(optional|needs).*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \
|
|
xargs ${sage-with-env}/bin/sage -t --optional=sage,sagemath_doc_html
|
|
'';
|
|
}
|