Forked from narayandesai/gist:5de29170207396c98108
Last active
August 29, 2015 14:04
-
-
Save bennofs/b79304aebcd9c4d61568 to your computer and use it in GitHub Desktop.
Use '' and not " to quote the string. This allows to use " inside without escaping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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