2014-12-02 12:09:36 +01:00
|
|
|
{ stdenv, lib, makeWrapper, fetchurl, curl, sasl, openssh, autoconf
|
2015-05-14 17:12:09 +02:00
|
|
|
, automake114x, libtool, unzip, gnutar, jdk, maven, python, wrapPython
|
2014-12-02 12:09:36 +01:00
|
|
|
, setuptools, distutils-cfg, boto, pythonProtobuf, apr, subversion
|
2015-05-06 05:55:14 +02:00
|
|
|
, leveldb, glog, perf, utillinux, libnl, iproute
|
2014-04-25 15:13:41 +02:00
|
|
|
}:
|
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
let
|
|
|
|
mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
|
|
|
|
soext = if stdenv.system == "x86_64-darwin" then "dylib" else "so";
|
2014-04-25 15:13:41 +02:00
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
in stdenv.mkDerivation rec {
|
2015-08-04 09:12:52 +02:00
|
|
|
version = "0.23.0";
|
2014-04-25 15:13:41 +02:00
|
|
|
name = "mesos-${version}";
|
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2014-04-25 15:13:41 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.apache.org/dist/mesos/${version}/mesos-${version}.tar.gz";
|
2015-08-04 09:12:52 +02:00
|
|
|
sha256 = "1v5xpn4wal4vcrvcklchx9slkpa8xlwqkdbnxzy9zkzpq5g3arxr";
|
2014-04-25 15:13:41 +02:00
|
|
|
};
|
|
|
|
|
2015-08-07 18:13:27 +02:00
|
|
|
patches = [
|
|
|
|
# https://reviews.apache.org/r/36610/
|
|
|
|
./rb36610.patch
|
|
|
|
];
|
|
|
|
|
2014-04-25 15:13:41 +02:00
|
|
|
buildInputs = [
|
2015-05-14 17:12:09 +02:00
|
|
|
makeWrapper autoconf automake114x libtool curl sasl jdk maven
|
2014-12-02 12:09:36 +01:00
|
|
|
python wrapPython boto distutils-cfg setuptools leveldb
|
|
|
|
subversion apr glog
|
2015-05-06 05:55:14 +02:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libnl
|
2014-04-25 15:13:41 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pythonProtobuf
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
2015-05-06 05:55:14 +02:00
|
|
|
export MAVEN_OPTS="-Dmaven.repo.local=${mavenRepo}"
|
2014-04-25 15:13:41 +02:00
|
|
|
|
|
|
|
substituteInPlace src/launcher/fetcher.cpp \
|
|
|
|
--replace '"tar' '"${gnutar}/bin/tar' \
|
|
|
|
--replace '"unzip' '"${unzip}/bin/unzip'
|
|
|
|
|
|
|
|
substituteInPlace src/cli/mesos-scp \
|
|
|
|
--replace "'scp " "'${openssh}/bin/scp "
|
2015-05-06 05:55:14 +02:00
|
|
|
|
|
|
|
substituteInPlace src/cli/python/mesos/cli.py \
|
|
|
|
--replace "['mesos-resolve'" "['$out/bin/mesos-resolve'"
|
|
|
|
|
|
|
|
'' + lib.optionalString (stdenv.isLinux) ''
|
|
|
|
|
|
|
|
substituteInPlace configure.ac \
|
|
|
|
--replace /usr/include/libnl3 ${libnl}/include/libnl3
|
|
|
|
|
|
|
|
substituteInPlace src/linux/perf.cpp \
|
|
|
|
--replace '"perf ' '"${perf}/bin/perf '
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/isolators/filesystem/shared.cpp \
|
|
|
|
--replace '"mount ' '"${utillinux}/bin/mount ' \
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/isolators/namespaces/pid.cpp \
|
|
|
|
--replace '"mount ' '"${utillinux}/bin/mount ' \
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/isolators/network/port_mapping.cpp \
|
|
|
|
--replace '"tc ' '"${iproute}/bin/tc ' \
|
|
|
|
--replace '"ip ' '"${iproute}/bin/ip ' \
|
|
|
|
--replace '"mount ' '"${utillinux}/bin/mount ' \
|
|
|
|
--replace '/bin/sh' "${stdenv.shell}"
|
2014-04-25 15:13:41 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--sbindir=\${out}/bin"
|
2014-12-02 12:09:36 +01:00
|
|
|
"--with-apr=${apr}"
|
|
|
|
"--with-svn=${subversion}"
|
|
|
|
"--with-leveldb=${leveldb}"
|
|
|
|
"--with-glog=${glog}"
|
2015-05-06 05:55:14 +02:00
|
|
|
"--with-glog=${glog}"
|
|
|
|
"--enable-optimize"
|
2014-12-02 12:09:36 +01:00
|
|
|
"--disable-python-dependency-install"
|
2015-05-06 05:55:14 +02:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--with-network-isolator"
|
2014-04-25 15:13:41 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/var
|
|
|
|
rm $out/bin/*.sh
|
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
mkdir -p $out/share/java
|
2014-04-25 15:13:41 +02:00
|
|
|
cp src/java/target/mesos-*.jar $out/share/java
|
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
MESOS_NATIVE_JAVA_LIBRARY=$out/lib/libmesos.${soext}
|
2014-04-25 15:13:41 +02:00
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
mkdir -p $out/nix-support
|
2014-04-25 15:13:41 +02:00
|
|
|
touch $out/nix-support/setup-hook
|
|
|
|
echo "export MESOS_NATIVE_JAVA_LIBRARY=$MESOS_NATIVE_JAVA_LIBRARY" >> $out/nix-support/setup-hook
|
|
|
|
echo "export MESOS_NATIVE_LIBRARY=$MESOS_NATIVE_JAVA_LIBRARY" >> $out/nix-support/setup-hook
|
|
|
|
|
|
|
|
# Inspired by: pkgs/development/python-modules/generic/default.nix
|
2015-08-04 09:12:52 +02:00
|
|
|
pushd src/python
|
2015-05-06 05:55:14 +02:00
|
|
|
mkdir -p $out/lib/${python.libPrefix}/site-packages
|
2014-04-25 15:13:41 +02:00
|
|
|
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
2015-08-04 09:12:52 +02:00
|
|
|
${python}/bin/${python.executable} setup.py install \
|
2014-04-25 15:13:41 +02:00
|
|
|
--install-lib=$out/lib/${python.libPrefix}/site-packages \
|
|
|
|
--old-and-unmanageable \
|
|
|
|
--prefix="$out"
|
|
|
|
rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
|
2015-08-04 09:12:52 +02:00
|
|
|
popd
|
2014-04-25 15:13:41 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
if test -e $out/nix-support/propagated-build-inputs; then
|
|
|
|
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
|
|
|
fi
|
|
|
|
|
|
|
|
for inputsfile in propagated-build-inputs propagated-native-build-inputs; do
|
|
|
|
if test -e $out/nix-support/$inputsfile; then
|
|
|
|
createBuildInputsPth $inputsfile "$(cat $out/nix-support/$inputsfile)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-05-06 05:55:14 +02:00
|
|
|
for f in $out/libexec/mesos/python/mesos/*.py; do
|
|
|
|
${python}/bin/${python.executable} -c "import py_compile; py_compile.compile('$f')"
|
|
|
|
done
|
|
|
|
|
2014-04-25 15:13:41 +02:00
|
|
|
# wrap the python programs
|
|
|
|
for prog in mesos-cat mesos-ps mesos-scp mesos-tail; do
|
|
|
|
wrapProgram "$out/bin/$prog" \
|
2015-05-06 05:55:14 +02:00
|
|
|
--prefix PYTHONPATH ":" "$out/libexec/mesos/python"
|
2014-04-25 15:13:41 +02:00
|
|
|
true
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "http://mesos.apache.org";
|
|
|
|
license = licenses.asl20;
|
|
|
|
description = "A cluster manager that provides efficient resource isolation and sharing across distributed applications, or frameworks";
|
2015-05-14 17:12:09 +02:00
|
|
|
maintainers = with maintainers; [ cstrahan offline rushmorem ];
|
2014-04-25 15:13:41 +02:00
|
|
|
platforms = with platforms; linux;
|
|
|
|
};
|
|
|
|
}
|