1{ lib, stdenv, fetchurl, unzip, jre, coreutils, makeDesktopItem, copyDesktopItems }:
2
3stdenv.mkDerivation rec {
4 pname = "basex";
5 version = "10.4";
6
7 src = fetchurl {
8 url = "http://files.basex.org/releases/${version}/BaseX${builtins.replaceStrings ["."] [""] version}.zip";
9 hash = "sha256-lwPEy4VVe2D36T3t0vnEodL6L8/Q6adOTGqWI0m7YpM=";
10 };
11
12 nativeBuildInputs = [ unzip copyDesktopItems ];
13 buildInputs = [ jre ];
14
15 desktopItems = lib.optional (!stdenv.isDarwin) (makeDesktopItem {
16 name = "basex";
17 exec = "basexgui %f";
18 icon = "${./basex.svg}"; # icon copied from Ubuntu basex package
19 comment = "Visually query and analyse your XML data";
20 desktopName = "BaseX XML Database";
21 genericName = "XML database tool";
22 categories = [ "Development" "Utility" "Database" ];
23 mimeTypes = [ "text/xml" ];
24 });
25
26 dontBuild = true;
27
28 installPhase = ''
29 runHook preInstall
30
31 # Remove Windows batch files (unclutter $out/bin)
32 rm ./bin/*.bat
33
34 mkdir -p "$out/share/basex"
35
36 cp -R bin etc lib webapp src BaseX.jar "$out"
37 cp -R readme.txt webapp "$out/share/basex"
38
39 # Use substitutions instead of wrapper scripts
40 for file in "$out"/bin/*; do
41 sed -i -e "s|/usr/bin/env bash|${stdenv.shell}|" \
42 -e "s|java|${jre}/bin/java|" \
43 -e "s|readlink|${coreutils}/bin/readlink|" \
44 -e "s|dirname|${coreutils}/bin/dirname|" \
45 -e "s|basename|${coreutils}/bin/basename|" \
46 -e "s|echo|${coreutils}/bin/echo|" \
47 "$file"
48 done
49
50 runHook postInstall
51 '';
52
53 meta = with lib; {
54 description = "XML database and XPath/XQuery processor";
55 longDescription = ''
56 BaseX is a very fast and light-weight, yet powerful XML database and
57 XPath/XQuery processor, including support for the latest W3C Full Text
58 and Update Recommendations. It supports large XML instances and offers a
59 highly interactive front-end (basexgui). Apart from two local standalone
60 modes, BaseX offers a client/server architecture.
61 '';
62 homepage = "https://basex.org/";
63 sourceProvenance = with sourceTypes; [ binaryBytecode ];
64 license = licenses.bsd3;
65 platforms = platforms.unix;
66 maintainers = [ maintainers.bjornfor ];
67 };
68}