pkgs/pkgs/apache-hop/default.nix

94 lines
2.2 KiB
Nix

{ pkgs ? import <nixpkgs> { } }:
pkgs.stdenv.mkDerivation rec {
pname = "apache-hop";
version = "2.15.0";
src = pkgs.fetchurl {
url = "https://dlcdn.apache.org/hop/2.15.0/apache-hop-client-2.15.0.zip";
name = "apache-hop-client-2.15.0.zip";
sha512 = "9581f48551e35a661a9a12f3e57f9dd5f0df7dc3f49e7931942c308e35aac1ab4ac05da727b290a6ba28a96bb99ea45d4f43dc749106a9846bd87fd0a08ee0e8";
};
nativeBuildInputs = with pkgs; [
makeWrapper
jdk17
unzip
];
buildInputs = with pkgs; [
gtk3
glib
webkitgtk_4_1
libsoup_2_4
cairo
gdk-pixbuf
atk
pango
];
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook preInstall
mkdir -p $out/opt/apache-hop
cp -r . $out/opt/apache-hop/
mkdir -p $out/bin
create_wrapper_script() {
local script_name=$1
cat > $out/bin/$script_name << EOF
#!/usr/bin/env bash
set -e
export HOP_CONFIG_FOLDER="\$HOME/.hop/config"
export HOP_AUDIT_FOLDER="\$HOME/.hop/audit"
mkdir -p "\$HOP_CONFIG_FOLDER" "\$HOP_AUDIT_FOLDER"
if [ ! -f "\$HOP_CONFIG_FOLDER/hop-config.json" ]; then
cp -r $out/opt/apache-hop/config/* "\$HOP_CONFIG_FOLDER/"
fi
exec $out/opt/apache-hop/$script_name.sh "\$@"
EOF
chmod +x $out/bin/$script_name
}
create_wrapper_script hop-gui
create_wrapper_script hop-run
create_wrapper_script hop-server
for script in hop-gui hop-run hop-server; do
mv $out/bin/$script $out/bin/.$script-wrapped
makeWrapper $out/bin/.$script-wrapped $out/bin/$script \
--set JAVA_HOME "${pkgs.jdk17}" \
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [
pkgs.gtk3
pkgs.glib
pkgs.webkitgtk_4_1
pkgs.libsoup_2_4
pkgs.cairo
pkgs.gdk-pixbuf
pkgs.atk
pkgs.pango
]}"
done
# Make sure shell scripts are executable
chmod +x $out/opt/apache-hop/*.sh
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Apache Hop - Data Integration Platform";
homepage = "https://hop.apache.org/";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with lib.maintainers; [ AmjadGhoufrane ];
};
}