flink: refactor

This commit is contained in:
Orivej Desh 2017-11-29 02:21:45 +00:00
parent ea37640791
commit dcd9d9f618
1 changed files with 20 additions and 16 deletions

View File

@ -1,12 +1,12 @@
{ stdenv, fetchzip, jre, { stdenv, fetchurl, makeWrapper, jre
version ? "1.3" }: , version ? "1.3" }:
let let
versionMap = { versionMap = {
"1.3" = { "1.3" = {
flinkVersion = "1.3.2"; flinkVersion = "1.3.2";
scalaVersion = "2.11"; scalaVersion = "2.11";
sha256 = "0dr8c1z4ncza6qp2zcklbmn0gj0l1rics3c8fiminkp8bl454ijg"; sha256 = "0mf4qz0963bflzidgslvwpdlvj9za9sj20dfybplw9lhd4sf52rp";
}; };
}; };
in in
@ -16,32 +16,36 @@ with versionMap.${version};
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "flink-${flinkVersion}"; name = "flink-${flinkVersion}";
src = fetchzip { src = fetchurl {
url = "mirror://apache/flink/${name}/${name}-bin-hadoop27-scala_${scalaVersion}.tgz"; url = "mirror://apache/flink/${name}/${name}-bin-hadoop27-scala_${scalaVersion}.tgz";
inherit sha256; inherit sha256;
}; };
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jre ]; buildInputs = [ jre ];
installPhase = '' installPhase = ''
mkdir -p $out rm bin/*.bat
cp -R bin conf examples lib opt resources $out
rm $out/bin/*.bat
chmod +x $out/bin\/*
cat <<EOF >> $out/conf/flink-conf.yaml mkdir -p $out/bin $out/opt/flink
mv * $out/opt/flink/
makeWrapper $out/opt/flink/bin/flink $out/bin/flink \
--prefix PATH : ${jre}/bin
cat <<EOF >> $out/opt/flink/conf/flink-conf.yaml
env.java.home: ${jre}" env.java.home: ${jre}"
env.log.dir: /tmp/flink-logs env.log.dir: /tmp/flink-logs
EOF EOF
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "An open-source stream processing framework for distributed, high-performing, always-available, and accurate data streaming applications."; description = "A distributed stream processing framework";
homepage = "https://flink.apache.org"; homepage = https://flink.apache.org;
downloadPage = "https://flink.apache.org/downloads.html"; downloadPage = https://flink.apache.org/downloads.html;
license = stdenv.lib.licenses.asl20; license = licenses.asl20;
platforms = stdenv.lib.platforms.all; platforms = platforms.all;
maintainers = with maintainers; [ mbode ]; maintainers = with maintainers; [ mbode ];
repositories.git = git://git.apache.org/flink.git; repositories.git = git://git.apache.org/flink.git;
}; };
} }