Skip to content

Instantly share code, notes, and snippets.

@narayandesai
Created July 29, 2014 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save narayandesai/5de29170207396c98108 to your computer and use it in GitHub Desktop.
Save narayandesai/5de29170207396c98108 to your computer and use it in GitHub Desktop.
{stdenv, bash, jre, spark} :
stdenv.mkDerivation rec {
name = "mesos-spark-${version}";
version = "1";
unpackPhase = "true";
installPhase = "
set -x
mkdir -p $out/bin
cat > $out/bin/mesos-spark-shell <<EOF
#!${bash}/bin/bash
set -o posix
export JAVA_HOME=${jre}
export SPARK_HOME=${spark}/lib/spark-1.0.1-bin-cdh4
for o in "\$@"; do
if [ "\$1" = "-c" -o "\$1" = "--cores" ]; then
shift
if [ -n "\$1" ]; then
OPTIONS="-Dspark.cores.max=\$1"
shift
fi
fi
done
EOF
chmod +x $out/bin/mesos-spark-shell
";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment