diff --git a/pkgs/applications/graphics/paraview/default.nix b/pkgs/applications/graphics/paraview/default.nix index 166e04149cc8..73cd39568f2b 100644 --- a/pkgs/applications/graphics/paraview/default.nix +++ b/pkgs/applications/graphics/paraview/default.nix @@ -1,10 +1,35 @@ -{ boost, cmake, fetchFromGitLab, ffmpeg, qtbase, qtx11extras, - qttools, qtxmlpatterns, qtsvg, gdal, gfortran, libXt, makeWrapper, - mkDerivation, ninja, mpi, python3, lib, tbb, libGLU, libGL }: +{ lib, stdenv, fetchFromGitLab, fetchurl +, boost, cmake, ffmpeg, qtbase, qtx11extras +, qttools, qtxmlpatterns, qtsvg, gdal, gfortran, libXt, makeWrapper +, mkDerivation, ninja, mpi, python3, tbb, libGLU, libGL +, withDocs ? true +}: -mkDerivation rec { - pname = "paraview"; +let version = "5.9.1"; + major = "5.9"; + + docFiles = [ + (fetchurl { + url = "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v${major}&type=data&os=Sources&downloadFile=ParaViewTutorial-${version}.pdf"; + name = "Tutorial.pdf"; + sha256 = "1knpirjbz3rv8p8n03p39vv8vi5imvxakjsssqgly09g0cnsikkw"; + }) + (fetchurl { + url = "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v${major}&type=data&os=Sources&downloadFile=ParaViewGettingStarted-${version}.pdf"; + name = "GettingStarted.pdf"; + sha256 = "14xhlvg7s7d5amqf4qfyamx2a6b66zf4cmlfm3s7iw3jq01x1lx6"; + }) + (fetchurl { + url = "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v${major}&type=data&os=Sources&downloadFile=ParaViewCatalystGuide-${version}.pdf"; + name = "CatalystGuide.pdf"; + sha256 = "133vcfrbg2nh15igl51ns6gnfn1is20vq6j0rg37wha697pmcr4a"; + }) + ]; + +in mkDerivation rec { + pname = "paraview"; + inherit version; src = fetchFromGitLab { domain = "gitlab.kitware.com"; @@ -68,6 +93,14 @@ mkDerivation rec { qtsvg ]; + postInstall = let docDir = "$out/share/paraview-${major}/doc"; in + lib.optionalString withDocs '' + mkdir -p ${docDir}; + for docFile in ${lib.concatStringsSep " " docFiles}; do + cp $docFile ${docDir}/$(stripHash $docFile); + done; + ''; + propagatedBuildInputs = [ (python3.withPackages (ps: with ps; [ numpy matplotlib mpi4py ])) ]; @@ -79,4 +112,5 @@ mkDerivation rec { maintainers = with maintainers; [ guibert ]; platforms = platforms.linux; }; + }