anchor.diff:                 -e "s|echo|${coreutils}/bin/echo|" \
               "$file"
       done
  +
  +    runHook postInstall
     '';
   
     meta = with lib; {
  
positive.code:     genericName = "XML database tool";
      categories = "Development;Utility;Database";
      mimeType = "text/xml";
    };
  
    dontBuild = true;
  
    installPhase = ''
      # Remove Windows batch files (unclutter $out/bin)
      rm ./bin/*.bat
  
      mkdir -p "$out/share/basex" "$out/share/applications"
  
      cp -R bin etc lib webapp src BaseX.jar "$out"
      cp -R readme.txt webapp "$out/share/basex"
  
      # Install desktop file
      cp "$desktopItem"/share/applications/* "$out/share/applications/"
  
      # Use substitutions instead of wrapper scripts
      for file in "$out"/bin/*; do
  
negative.code: { lib, stdenv, fetchurl, unzip, jre, coreutils, makeDesktopItem, copyDesktopItems }:
  
  stdenv.mkDerivation rec {
    pname = "basex";
    version = "9.6.3";
  
    src = fetchurl {
      url = "http://files.basex.org/releases/${version}/BaseX${builtins.replaceStrings ["."] [""] version}.zip";
      hash = "sha256-OlIAyGUQKrl+Zu79p6cahHpx59zLozGkUDAEvykGN6Y=";
    };
  
    nativeBuildInputs = [ unzip copyDesktopItems ];
    buildInputs = [ jre ];
  
    desktopItems = lib.optional (!stdenv.isDarwin) (makeDesktopItem {
      name = "basex";
      exec = "basexgui %f";
      icon = "${./basex.svg}"; # icon copied from Ubuntu basex package
  