2017-09-18 03:31:18 +00:00
|
|
|
{ stdenv, lib, makeWrapper, fetchurl, curl, sasl, openssh
|
|
|
|
, unzip, gnutar, jdk, python, wrapPython
|
2018-07-21 00:44:44 +00:00
|
|
|
, setuptools, boto, pythonProtobuf, apr, subversion, gzip
|
2016-01-23 14:49:19 +00:00
|
|
|
, leveldb, glog, perf, utillinux, libnl, iproute, openssl, libevent
|
2017-09-18 03:31:18 +00:00
|
|
|
, ethtool, coreutils, which, iptables, maven
|
|
|
|
, bash, autoreconfHook
|
2018-08-24 23:21:00 +00:00
|
|
|
, utf8proc, lz4
|
2018-04-05 14:16:20 +00:00
|
|
|
, withJava ? !stdenv.isDarwin
|
2014-04-25 13:13:41 +00:00
|
|
|
}:
|
|
|
|
|
2015-05-06 03:55:14 +00:00
|
|
|
let
|
|
|
|
mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
|
2016-12-28 05:19:51 +00:00
|
|
|
# `tar -z` requires gzip on $PATH, so wrap tar.
|
|
|
|
# At some point, we should try to patch mesos so we add gzip to the PATH when
|
|
|
|
# tar is invoked. I think that only needs to be done here:
|
|
|
|
# src/common/command_utils.cpp
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/13783
|
|
|
|
tarWithGzip = lib.overrideDerivation gnutar (oldAttrs: {
|
2017-11-17 12:19:36 +00:00
|
|
|
# Original builder is bash 4.3.42 from bootstrap tools, too old for makeWrapper.
|
|
|
|
builder = "${bash}/bin/bash";
|
2016-12-28 05:19:51 +00:00
|
|
|
buildInputs = (oldAttrs.buildInputs or []) ++ [ makeWrapper ];
|
|
|
|
postInstall = (oldAttrs.postInstall or "") + ''
|
|
|
|
wrapProgram $out/bin/tar --prefix PATH ":" "${gzip}/bin"
|
|
|
|
'';
|
|
|
|
});
|
2014-04-25 13:13:41 +00:00
|
|
|
|
2015-05-06 03:55:14 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2018-01-27 12:38:31 +00:00
|
|
|
version = "1.4.1";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mesos";
|
2014-04-25 13:13:41 +00:00
|
|
|
|
2016-02-22 22:25:50 +00:00
|
|
|
enableParallelBuilding = true;
|
2015-05-06 03:55:14 +00:00
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2014-04-25 13:13:41 +00:00
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "mirror://apache/mesos/${version}/${pname}-${version}.tar.gz";
|
2018-01-27 12:38:31 +00:00
|
|
|
sha256 = "1c7l0rim9ija913gpppz2mcms08ywyqhlzbbspqsi7wwfdd7jwsr";
|
2014-04-25 13:13:41 +00:00
|
|
|
};
|
|
|
|
|
2015-08-07 16:13:27 +00:00
|
|
|
patches = [
|
|
|
|
# https://reviews.apache.org/r/36610/
|
2016-12-28 05:19:51 +00:00
|
|
|
# TODO: is this still needed?
|
2015-08-07 16:13:27 +00:00
|
|
|
./rb36610.patch
|
2016-09-02 14:02:21 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
# see https://github.com/cstrahan/mesos/tree/nixos-${version}
|
|
|
|
./nixos.patch
|
2015-08-07 16:13:27 +00:00
|
|
|
];
|
2017-09-18 03:31:18 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
];
|
2014-04-25 13:13:41 +00:00
|
|
|
buildInputs = [
|
2018-04-05 14:16:20 +00:00
|
|
|
makeWrapper curl sasl
|
2015-11-20 12:48:30 +00:00
|
|
|
python wrapPython boto setuptools leveldb
|
2018-04-05 14:16:20 +00:00
|
|
|
subversion apr glog openssl libevent
|
2018-08-24 23:21:00 +00:00
|
|
|
utf8proc lz4
|
2015-05-06 03:55:14 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libnl
|
2018-04-05 14:16:20 +00:00
|
|
|
] ++ lib.optionals withJava [
|
|
|
|
jdk maven
|
2014-04-25 13:13:41 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pythonProtobuf
|
|
|
|
];
|
2019-01-15 14:12:26 +00:00
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=format-overflow -Wno-error=class-memaccess";
|
|
|
|
|
2014-04-25 13:13:41 +00:00
|
|
|
preConfigure = ''
|
2017-03-01 21:05:04 +00:00
|
|
|
# https://issues.apache.org/jira/browse/MESOS-6616
|
|
|
|
configureFlagsArray+=(
|
|
|
|
"CXXFLAGS=-O2 -Wno-error=strict-aliasing"
|
|
|
|
)
|
|
|
|
|
2017-11-07 17:54:55 +00:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/jsonify.hpp \
|
|
|
|
--replace '<xlocale.h>' '<locale.h>'
|
2017-03-01 21:05:04 +00:00
|
|
|
# Fix cases where makedev(),major(),minor() are referenced through
|
|
|
|
# <sys/types.h> instead of <sys/sysmacros.h>
|
|
|
|
sed 1i'#include <sys/sysmacros.h>' -i src/linux/fs.cpp
|
|
|
|
sed 1i'#include <sys/sysmacros.h>' -i src/slave/containerizer/mesos/isolators/gpu/isolator.cpp
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/os/posix/chown.hpp \
|
|
|
|
--subst-var-by chown ${coreutils}/bin/chown
|
|
|
|
|
|
|
|
substituteInPlace 3rdparty/stout/Makefile.am \
|
2017-09-28 10:58:25 +00:00
|
|
|
--replace "-lprotobuf" \
|
|
|
|
"${pythonProtobuf.protobuf}/lib/libprotobuf.a"
|
2016-09-28 12:58:03 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/os/posix/fork.hpp \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by sh ${bash}/bin/bash
|
2016-03-11 14:23:48 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace 3rdparty/stout/include/stout/posix/os.hpp \
|
|
|
|
--subst-var-by tar ${tarWithGzip}/bin/tar
|
2014-04-25 13:13:41 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
substituteInPlace src/cli/mesos-scp \
|
|
|
|
--subst-var-by scp ${openssh}/bin/scp
|
2016-09-28 12:58:03 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/common/command_utils.cpp \
|
|
|
|
--subst-var-by curl ${curl}/bin/curl \
|
|
|
|
--subst-var-by gzip ${gzip}/bin/gzip \
|
|
|
|
--subst-var-by sha512sum ${coreutils}/bin/sha512sum \
|
|
|
|
--subst-var-by tar ${tarWithGzip}/bin/tar
|
|
|
|
|
2014-04-25 13:13:41 +00:00
|
|
|
substituteInPlace src/launcher/fetcher.cpp \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by cp ${coreutils}/bin/cp \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by gzip ${gzip}/bin/gzip \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by tar ${tarWithGzip}/bin/tar \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by unzip ${unzip}/bin/unzip
|
2014-04-25 13:13:41 +00:00
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/python/cli/src/mesos/cli.py \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by mesos-resolve $out/bin/mesos-resolve
|
2016-09-28 12:58:03 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/python/native_common/ext_modules.py.in \
|
2017-09-28 10:58:25 +00:00
|
|
|
--replace "-lprotobuf" \
|
|
|
|
"${pythonProtobuf.protobuf}/lib/libprotobuf.a"
|
2016-12-28 05:19:51 +00:00
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/gpu/volume.cpp \
|
|
|
|
--subst-var-by cp ${coreutils}/bin/cp \
|
|
|
|
--subst-var-by which ${which}/bin/which
|
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/posix/disk.cpp \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by du ${coreutils}/bin/du
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/provisioner/backends/copy.cpp \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by cp ${coreutils}/bin/cp \
|
|
|
|
--subst-var-by rm ${coreutils}/bin/rm
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
substituteInPlace src/uri/fetchers/copy.cpp \
|
|
|
|
--subst-var-by cp ${coreutils}/bin/cp
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-09-29 01:39:19 +00: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
|
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/Makefile.am \
|
|
|
|
--subst-var-by mavenRepo ${mavenRepo} \
|
2017-09-28 10:58:25 +00:00
|
|
|
--replace "-lprotobuf" \
|
|
|
|
"${pythonProtobuf.protobuf}/lib/libprotobuf.a"
|
2016-12-28 05:19:51 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2016-09-28 12:58:03 +00:00
|
|
|
|
2016-09-29 01:39:19 +00:00
|
|
|
substituteInPlace src/linux/perf.cpp \
|
|
|
|
--subst-var-by perf ${perf}/bin/perf
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/filesystem/linux.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/filesystem/shared.cpp \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/gpu/isolator.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/namespaces/pid.cpp \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
2015-05-06 03:55:14 +00:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/network/cni/cni.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.cpp \
|
|
|
|
--subst-var-by iptables ${iptables}/bin/iptables
|
|
|
|
|
2016-01-23 14:49:19 +00:00
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/network/port_mapping.cpp \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by ethtool ${ethtool}/sbin/ethtool \
|
2016-09-29 01:39:19 +00:00
|
|
|
--subst-var-by ip ${iproute}/bin/ip \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount \
|
2016-12-28 05:19:51 +00:00
|
|
|
--subst-var-by tc ${iproute}/bin/tc
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/volume/image.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
|
|
|
|
|
|
|
substituteInPlace src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp \
|
|
|
|
--subst-var-by mount ${utillinux}/bin/mount
|
2014-04-25 13:13:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--sbindir=\${out}/bin"
|
2016-04-16 16:41:26 +00:00
|
|
|
"--with-apr=${apr.dev}"
|
2016-04-16 17:47:36 +00:00
|
|
|
"--with-svn=${subversion.dev}"
|
2014-12-02 11:09:36 +00:00
|
|
|
"--with-leveldb=${leveldb}"
|
|
|
|
"--with-glog=${glog}"
|
2015-05-06 03:55:14 +00:00
|
|
|
"--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 17:44:32 +00:00
|
|
|
"--with-ssl=${openssl.dev}"
|
2016-01-23 14:49:19 +00:00
|
|
|
"--enable-libevent"
|
2016-04-16 17:35:59 +00:00
|
|
|
"--with-libevent=${libevent.dev}"
|
2016-09-29 01:39:19 +00:00
|
|
|
"--with-protobuf=${pythonProtobuf.protobuf}"
|
2017-09-18 03:31:18 +00:00
|
|
|
"PROTOBUF_JAR=${mavenRepo}/com/google/protobuf/protobuf-java/3.3.0/protobuf-java-3.3.0.jar"
|
2018-04-05 14:16:20 +00:00
|
|
|
(if withJava then "--enable-java" else "--disable-java")
|
2015-05-06 03:55:14 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--with-network-isolator"
|
2016-09-29 01:39:19 +00:00
|
|
|
"--with-nl=${libnl.dev}"
|
2014-04-25 13:13:41 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/var
|
|
|
|
rm $out/bin/*.sh
|
|
|
|
|
|
|
|
# Inspired by: pkgs/development/python-modules/generic/default.nix
|
2015-08-04 07:12:52 +00:00
|
|
|
pushd src/python
|
2015-05-06 03:55:14 +00:00
|
|
|
mkdir -p $out/lib/${python.libPrefix}/site-packages
|
2014-04-25 13:13:41 +00:00
|
|
|
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
2015-08-04 07:12:52 +00:00
|
|
|
${python}/bin/${python.executable} setup.py install \
|
2014-04-25 13:13:41 +00: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 07:12:52 +00: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
|
2018-04-05 14:16:20 +00:00
|
|
|
'' + stdenv.lib.optionalString withJava ''
|
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp src/java/target/mesos-*.jar $out/share/java
|
|
|
|
|
|
|
|
MESOS_NATIVE_JAVA_LIBRARY=$out/lib/libmesos${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
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
|
2014-04-25 13:13:41 +00: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 03:55:14 +00: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 13:13:41 +00: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 13:13:41 +00: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";
|
2020-03-09 16:21:41 +00:00
|
|
|
maintainers = with maintainers; [ cstrahan offline ];
|
2018-04-05 14:16:20 +00:00
|
|
|
platforms = platforms.unix;
|
2020-03-29 17:57:44 +00:00
|
|
|
broken = true; # Broken since 2019-10-22 (https://hydra.nixos.org/build/115475123)
|
2014-04-25 13:13:41 +00:00
|
|
|
};
|
|
|
|
}
|