2014-12-02 11:09:36 +00:00
|
|
|
{ stdenv, lib, makeWrapper, fetchurl, curl, sasl, openssh, autoconf
|
2016-01-23 14:49:19 +00:00
|
|
|
, automake115x, libtool, unzip, gnutar, jdk, maven, python, wrapPython
|
2016-02-22 22:25:50 +00:00
|
|
|
, setuptools, boto, pythonProtobuf, apr, subversion, gzip, systemd
|
2016-01-23 14:49:19 +00:00
|
|
|
, leveldb, glog, perf, utillinux, libnl, iproute, openssl, libevent
|
2016-09-29 02:39:19 +01:00
|
|
|
, ethtool, coreutils
|
2016-02-22 22:25:50 +00:00
|
|
|
, bash
|
2014-04-25 14:13:41 +01:00
|
|
|
}:
|
|
|
|
|
2015-05-06 04:55:14 +01:00
|
|
|
let
|
|
|
|
mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
|
|
|
|
soext = if stdenv.system == "x86_64-darwin" then "dylib" else "so";
|
2014-04-25 14:13:41 +01:00
|
|
|
|
2015-05-06 04:55:14 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2016-09-29 02:39:19 +01:00
|
|
|
version = "1.0.1";
|
2014-04-25 14:13:41 +01:00
|
|
|
name = "mesos-${version}";
|
|
|
|
|
2016-02-22 22:25:50 +00:00
|
|
|
enableParallelBuilding = true;
|
2015-05-06 04:55:14 +01:00
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2014-04-25 14:13:41 +01:00
|
|
|
src = fetchurl {
|
2015-12-28 21:27:47 +00:00
|
|
|
url = "mirror://apache/mesos/${version}/${name}.tar.gz";
|
2016-09-29 02:39:19 +01:00
|
|
|
sha256 = "1hdh2wh11ck98ycfrxfzgivgk2pjl3638vkyw14xj7faj9qxjlz0";
|
2014-04-25 14:13:41 +01:00
|
|
|
};
|
|
|
|
|
2015-08-07 17:13:27 +01:00
|
|
|
patches = [
|
|
|
|
# https://reviews.apache.org/r/36610/
|
|
|
|
./rb36610.patch
|
2016-09-02 15:02:21 +01:00
|
|
|
|
|
|
|
# https://issues.apache.org/jira/browse/MESOS-6013
|
|
|
|
./rb51324.patch
|
|
|
|
./rb51325.patch
|
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
# see https://github.com/cstrahan/mesos/tree/nixos-${version}
|
|
|
|
./nixos.patch
|
2015-08-07 17:13:27 +01:00
|
|
|
];
|
|
|
|
|
2014-04-25 14:13:41 +01:00
|
|
|
buildInputs = [
|
2016-01-23 14:49:19 +00:00
|
|
|
makeWrapper autoconf automake115x libtool curl sasl jdk maven
|
2015-11-20 12:48:30 +00:00
|
|
|
python wrapPython boto setuptools leveldb
|
2016-01-23 14:49:19 +00:00
|
|
|
subversion apr glog openssl libevent
|
2015-05-06 04:55:14 +01:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libnl
|
2014-04-25 14:13:41 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pythonProtobuf
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/os/posix/fork.hpp \
|
|
|
|
--subst-var-by sh ${bash}/bin/bash
|
2016-09-28 13:58:03 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/os/posix/shell.hpp \
|
|
|
|
--subst-var-by sh ${bash}/bin/bash
|
2016-03-11 14:23:48 +00:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/Makefile.am \
|
|
|
|
--subst-var-by mavenRepo ${mavenRepo}
|
2014-04-25 14:13:41 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/cli/mesos-scp \
|
|
|
|
--subst-var-by scp ${openssh}/bin/scp
|
2016-09-28 13:58:03 +01:00
|
|
|
|
2014-04-25 14:13:41 +01:00
|
|
|
substituteInPlace src/launcher/fetcher.cpp \
|
2016-09-29 02:39:19 +01:00
|
|
|
--subst-var-by gzip ${gzip}/bin/gzip \
|
|
|
|
--subst-var-by tar ${gnutar}/bin/tar \
|
|
|
|
--subst-var-by unzip ${unzip}/bin/unzip
|
2014-04-25 14:13:41 +01:00
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/python/cli/src/mesos/cli.py \
|
2016-09-29 02:39:19 +01:00
|
|
|
--subst-var-by mesos-resolve $out/bin/mesos-resolve
|
2016-09-28 13:58:03 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/posix/disk.cpp \
|
|
|
|
--subst-var-by du ${coreutils}/bin/du \
|
|
|
|
--subst-var-by cp ${coreutils}/bin/cp
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/provisioner/backends/copy.cpp \
|
|
|
|
--subst-var-by cp ${coreutils}/bin/cp
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/uri/fetchers/copy.cpp \
|
|
|
|
--subst-var-by cp ${coreutils}/bin/cp
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/uri/fetchers/curl.cpp \
|
|
|
|
--subst-var-by curl ${curl}/bin/curl
|
|
|
|
|
|
|
|
substituteInPlace src/uri/fetchers/docker.cpp \
|
|
|
|
--subst-var-by curl ${curl}/bin/curl
|
|
|
|
|
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2016-09-28 13:58:03 +01:00
|
|
|
|
2016-09-29 02:39:19 +01:00
|
|
|
substituteInPlace src/linux/perf.cpp \
|
|
|
|
--subst-var-by perf ${perf}/bin/perf
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/filesystem/shared.cpp \
|
2016-09-29 02:39:19 +01:00
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/namespaces/pid.cpp \
|
2016-09-29 02:39:19 +01:00
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
2015-05-06 04:55:14 +01:00
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/network/port_mapping.cpp \
|
2016-09-29 02:39:19 +01:00
|
|
|
--subst-var-by tc ${iproute}/bin/tc \
|
|
|
|
--subst-var-by ip ${iproute}/bin/ip \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount \
|
|
|
|
--subst-var-by sh ${stdenv.shell} \
|
|
|
|
--subst-var-by ethtool ${ethtool}/sbin/ethtool
|
2014-04-25 14:13:41 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--sbindir=\${out}/bin"
|
2016-04-16 17:41:26 +01:00
|
|
|
"--with-apr=${apr.dev}"
|
2016-04-16 18:47:36 +01:00
|
|
|
"--with-svn=${subversion.dev}"
|
2014-12-02 11:09:36 +00:00
|
|
|
"--with-leveldb=${leveldb}"
|
|
|
|
"--with-glog=${glog}"
|
2015-05-06 04:55:14 +01:00
|
|
|
"--with-glog=${glog}"
|
|
|
|
"--enable-optimize"
|
2014-12-02 11:09:36 +00:00
|
|
|
"--disable-python-dependency-install"
|
2016-01-23 14:49:19 +00:00
|
|
|
"--enable-ssl"
|
2016-04-16 18:44:32 +01:00
|
|
|
"--with-ssl=${openssl.dev}"
|
2016-01-23 14:49:19 +00:00
|
|
|
"--enable-libevent"
|
2016-04-16 18:35:59 +01:00
|
|
|
"--with-libevent=${libevent.dev}"
|
2016-09-29 02:39:19 +01:00
|
|
|
"--with-protobuf=${pythonProtobuf.protobuf}"
|
|
|
|
"PROTOBUF_JAR=${mavenRepo}/com/google/protobuf/protobuf-java/2.6.1/protobuf-java-2.6.1.jar"
|
2015-05-06 04:55:14 +01:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--with-network-isolator"
|
2016-09-29 02:39:19 +01:00
|
|
|
"--with-nl=${libnl.dev}"
|
2014-04-25 14:13:41 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/var
|
|
|
|
rm $out/bin/*.sh
|
|
|
|
|
2015-05-06 04:55:14 +01:00
|
|
|
mkdir -p $out/share/java
|
2014-04-25 14:13:41 +01:00
|
|
|
cp src/java/target/mesos-*.jar $out/share/java
|
|
|
|
|
2015-05-06 04:55:14 +01:00
|
|
|
MESOS_NATIVE_JAVA_LIBRARY=$out/lib/libmesos.${soext}
|
2014-04-25 14:13:41 +01:00
|
|
|
|
2015-05-06 04:55:14 +01:00
|
|
|
mkdir -p $out/nix-support
|
2014-04-25 14:13:41 +01: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 08:12:52 +01:00
|
|
|
pushd src/python
|
2015-05-06 04:55:14 +01:00
|
|
|
mkdir -p $out/lib/${python.libPrefix}/site-packages
|
2014-04-25 14:13:41 +01:00
|
|
|
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
2015-08-04 08:12:52 +01:00
|
|
|
${python}/bin/${python.executable} setup.py install \
|
2014-04-25 14:13:41 +01: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 08:12:52 +01:00
|
|
|
popd
|
2016-01-23 14:49:19 +00:00
|
|
|
|
2016-02-22 22:25:50 +00:00
|
|
|
# optional python dependency for mesos cli
|
2016-01-23 14:49:19 +00:00
|
|
|
pushd src/python/cli
|
|
|
|
${python}/bin/${python.executable} setup.py install \
|
|
|
|
--install-lib=$out/lib/${python.libPrefix}/site-packages \
|
|
|
|
--old-and-unmanageable \
|
|
|
|
--prefix="$out"
|
|
|
|
popd
|
2014-04-25 14:13:41 +01: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 04:55:14 +01: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 14:13:41 +01:00
|
|
|
# wrap the python programs
|
|
|
|
for prog in mesos-cat mesos-ps mesos-scp mesos-tail; do
|
|
|
|
wrapProgram "$out/bin/$prog" \
|
2016-01-23 14:49:19 +00:00
|
|
|
--prefix PYTHONPATH ":" "$out/lib/${python.libPrefix}/site-packages"
|
2014-04-25 14:13:41 +01: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";
|
2016-02-22 22:25:50 +00:00
|
|
|
maintainers = with maintainers; [ cstrahan kevincox offline rushmorem ];
|
2015-11-17 20:29:29 +00:00
|
|
|
platforms = platforms.linux;
|
2014-04-25 14:13:41 +01:00
|
|
|
};
|
|
|
|
}
|