{ lib, stdenv, fetchFromGitHub, callPackage, writeScript, cmake, wrapQtAppsHook , boost, qt5, llvmPackages, gcc, jdk, pythonPackages, desktop-file-utils , shared-mime-info, imagemagick, which, coreutils, maven, fetchpatch }: let # TODO: remove when version incompatibility issue with python3Packages.jedi is # resolved parso = pythonPackages.callPackage ./parso.nix {}; jedi = pythonPackages.callPackage ./jedi.nix { inherit parso; }; pythonIndexer = pythonPackages.callPackage ./python.nix { inherit jedi parso; }; javaIndexer = callPackage ./java.nix {}; # Upstream script: # https://github.com/CoatiSoftware/Sourcetrail/blob/master/script/update_java_indexer.sh installJavaIndexer = writeScript "update_java_indexer.sh" '' #!${stdenv.shell} cd "$(dirname "$0")/.." dst="$out/opt/sourcetrail/share/data/java/lib" mkdir -p "$dst" cp "${javaIndexer}/target/java-indexer-1.0.jar" "$dst/java-indexer.jar" cp -r java_indexer/lib/*.jar "$dst" ''; # Upstream script: # https://github.com/CoatiSoftware/Sourcetrail/blob/master/script/download_python_indexer.sh installPythonIndexer = writeScript "download_python_indexer.sh" '' #!${stdenv.shell} mkdir -p $out/opt/sourcetrail/share/data ln -s "${pythonIndexer}/bin" "$out/opt/sourcetrail/share/data/python" ''; in stdenv.mkDerivation rec { pname = "sourcetrail"; version = "2020.2.43"; src = fetchFromGitHub { owner = "CoatiSoftware"; repo = "Sourcetrail"; rev = version; sha256 = "0jp9y86xzkcxikc1cn4f6gqgg6zdssck08677ldagw25p1zadvzw"; }; patches = let url = commit: "https://github.com/CoatiSoftware/Sourcetrail/commit/${commit}.patch"; in [ ./disable-updates.patch ./disable-failing-tests.patch # FIXME: 5 test cases failing due to sandbox # TODO: remove on next release (fetchpatch { name = "fix-filecopy.patch"; url = url "d079d1787c9e5cadcf41a003666dc0746cc1cda0"; sha256 = "0mixy2a4s16kv2q89k7y4dv21wnv2zd86i4gdwn3xz977y8hf92b"; }) (fetchpatch { name = "fix-broken-test.patch"; url = url "85329174bac8a301733100dc4540258f977e2c5a"; sha256 = "17l4417sbmkrgr6v3fbazlmkzl9774zrpjv2n9zwfrz52y30f7b9"; }) ]; nativeBuildInputs = [ cmake jdk wrapQtAppsHook desktop-file-utils imagemagick javaIndexer # the resulting jar file is copied by our install script ] ++ lib.optionals doCheck testBinPath; buildInputs = [ boost pythonIndexer shared-mime-info ] ++ (with qt5; [ qtbase qtsvg ]) ++ (with llvmPackages; [ libclang llvm ]); binPath = [ gcc jdk.jre maven which ]; testBinPath = binPath ++ [ coreutils ]; cmakeFlags = [ "-DBoost_USE_STATIC_LIBS=OFF" "-DBUILD_CXX_LANGUAGE_PACKAGE=ON" "-DCMAKE_PREFIX_PATH=${llvmPackages.clang-unwrapped}" "-DBUILD_JAVA_LANGUAGE_PACKAGE=ON" "-DBUILD_PYTHON_LANGUAGE_PACKAGE=ON" ]; postPatch = let major = lib.versions.major version; minor = lib.versions.minor version; patch = lib.versions.patch version; in '' # Upstream script obtains it's version from git: # https://github.com/CoatiSoftware/Sourcetrail/blob/master/cmake/version.cmake cat > cmake/version.cmake <