nixpkgs/pkgs/by-name/ba/basex/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
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.
2024-11-09 20:04:51 +08:00

69 lines
2.2 KiB
Nix

{ lib, stdenv, fetchurl, unzip, jre, coreutils, makeDesktopItem, copyDesktopItems }:
stdenv.mkDerivation rec {
pname = "basex";
version = "11.4";
src = fetchurl {
url = "http://files.basex.org/releases/${version}/BaseX${builtins.replaceStrings ["."] [""] version}.zip";
hash = "sha256-gArcTVD4OoXWB6r9I8q2EXuwCRmbLFE1sO2yfo3AWCQ=";
};
nativeBuildInputs = [ unzip copyDesktopItems ];
buildInputs = [ jre ];
desktopItems = lib.optional (!stdenv.hostPlatform.isDarwin) (makeDesktopItem {
name = "basex";
exec = "basexgui %f";
icon = "${./basex.svg}"; # icon copied from Ubuntu basex package
comment = "Visually query and analyse your XML data";
desktopName = "BaseX XML Database";
genericName = "XML database tool";
categories = [ "Development" "Utility" "Database" ];
mimeTypes = [ "text/xml" ];
});
dontBuild = true;
installPhase = ''
runHook preInstall
# Remove Windows batch files (unclutter $out/bin)
rm ./bin/*.bat
mkdir -p "$out/share/basex"
cp -R bin etc lib webapp src BaseX.jar "$out"
cp -R readme.txt webapp "$out/share/basex"
# Use substitutions instead of wrapper scripts
for file in "$out"/bin/*; do
sed -i -e "s|/usr/bin/env bash|${stdenv.shell}|" \
-e "s|java|${jre}/bin/java|" \
-e "s|readlink|${coreutils}/bin/readlink|" \
-e "s|dirname|${coreutils}/bin/dirname|" \
-e "s|basename|${coreutils}/bin/basename|" \
-e "s|echo|${coreutils}/bin/echo|" \
"$file"
done
runHook postInstall
'';
meta = with lib; {
description = "XML database and XPath/XQuery processor";
longDescription = ''
BaseX is a very fast and light-weight, yet powerful XML database and
XPath/XQuery processor, including support for the latest W3C Full Text
and Update Recommendations. It supports large XML instances and offers a
highly interactive front-end (basexgui). Apart from two local standalone
modes, BaseX offers a client/server architecture.
'';
homepage = "https://basex.org/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = [ maintainers.bjornfor ];
};
}