1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/servers/computing/storm/default.nix

70 lines
2 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl, zip, unzip
2020-06-22 14:36:39 +01:00
, jdk, python
, confFile ? ""
, extraLibraryPaths ? []
, extraJars ? []
}:
2013-02-07 14:32:10 +00:00
stdenv.mkDerivation rec {
2020-06-22 14:36:39 +01:00
pname = "apache-storm";
2020-07-31 18:32:55 +01:00
version = "2.2.0";
2020-06-22 14:36:39 +01:00
name = "${pname}-${version}";
2013-02-07 14:32:10 +00:00
src = fetchurl {
2020-06-22 14:36:39 +01:00
url = "mirror://apache/storm/${name}/${name}.tar.gz";
2020-07-31 18:32:55 +01:00
sha256 = "0xc6lfilfkkjyds59b6c770gj21v9srzpln31c9qb3ls6hzic8gn";
2013-02-07 14:32:10 +00:00
};
2020-06-22 14:36:39 +01:00
buildInputs = [ zip unzip ];
2013-02-07 14:32:10 +00:00
installPhase = ''
mkdir -p $out/share/${name}
mv public $out/docs
mv examples $out/share/${name}/.
2013-02-07 14:32:10 +00:00
2018-04-12 22:35:24 +01:00
mv external extlib* lib $out/.
mv conf bin $out/.
mv log4j2 $out/conf/.
'';
fixupPhase = ''
# Fix python reference
sed -i \
-e '19iPYTHON=${python}/bin/python' \
-e 's|#!/usr/bin/.*python|#!${python}/bin/python|' \
$out/bin/storm
sed -i \
-e 's|#!/usr/bin/.*python|#!${python}/bin/python|' \
-e "s|STORM_CONF_DIR = .*|STORM_CONF_DIR = os.getenv('STORM_CONF_DIR','$out/conf')|" \
-e 's|STORM_LOG4J2_CONF_DIR =.*|STORM_LOG4J2_CONF_DIR = os.path.join(STORM_CONF_DIR, "log4j2")|' \
$out/bin/storm.py
2020-06-22 14:36:39 +01:00
# Default jdk location
sed -i -e 's|#.*export JAVA_HOME=.*|export JAVA_HOME="${jdk.home}"|' \
$out/conf/storm-env.sh
2020-06-22 14:36:39 +01:00
ls -lh $out/lib
unzip $out/lib/storm-client-${version}.jar defaults.yaml;
zip -d $out/lib/storm-client-${version}.jar defaults.yaml;
sed -i \
2020-06-22 14:36:39 +01:00
-e 's|java.library.path: .*|java.library.path: "${lib.concatStringsSep ":" extraLibraryPaths}"|' \
-e 's|storm.log4j2.conf.dir: .*|storm.log4j2.conf.dir: "conf/log4j2"|' \
defaults.yaml
${if confFile != "" then ''cat ${confFile} >> defaults.yaml'' else ""}
mv defaults.yaml $out/conf;
2020-06-22 14:36:39 +01:00
# Link to extra jars
cd $out/lib;
${lib.concatMapStrings (jar: "ln -s ${jar};\n") extraJars}
2013-02-07 14:32:10 +00:00
'';
dontStrip = true;
meta = with stdenv.lib; {
homepage = "http://storm.apache.org";
description = "Distributed realtime computation system";
license = licenses.asl20;
maintainers = with maintainers; [ edwtjo vizanto ];
platforms = with platforms; unix;
2013-02-07 14:32:10 +00:00
};
}