2018-11-06 13:35:48 +00:00
|
|
|
{ stdenv, runCommand, fetchurl
|
|
|
|
, ensureNewerSourcesHook
|
|
|
|
, cmake, pkgconfig
|
|
|
|
, which, git
|
2019-06-14 11:46:07 +01:00
|
|
|
, boost, python3Packages
|
2018-11-06 13:35:48 +00:00
|
|
|
, libxml2, zlib, lz4
|
|
|
|
, openldap, lttng-ust
|
|
|
|
, babeltrace, gperf
|
2019-11-10 23:24:27 +00:00
|
|
|
, gtest
|
2018-11-06 13:35:48 +00:00
|
|
|
, cunit, snappy
|
|
|
|
, rocksdb, makeWrapper
|
2019-11-10 23:24:27 +00:00
|
|
|
, leveldb, oathToolkit
|
2020-01-07 02:51:20 +00:00
|
|
|
, libnl, libcap_ng
|
2020-07-01 09:12:32 +01:00
|
|
|
, rdkafka
|
2015-11-19 13:21:07 +00:00
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
# Optional Dependencies
|
|
|
|
, yasm ? null, fcgi ? null, expat ? null
|
|
|
|
, curl ? null, fuse ? null
|
2019-06-14 11:46:07 +01:00
|
|
|
, libedit ? null, libatomic_ops ? null
|
2018-11-06 13:35:48 +00:00
|
|
|
, libs3 ? null
|
2015-11-19 13:21:07 +00:00
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
# Mallocs
|
|
|
|
, jemalloc ? null, gperftools ? null
|
|
|
|
|
|
|
|
# Crypto Dependencies
|
|
|
|
, cryptopp ? null
|
|
|
|
, nss ? null, nspr ? null
|
|
|
|
|
|
|
|
# Linux Only Dependencies
|
2019-06-14 11:46:07 +01:00
|
|
|
, linuxHeaders, utillinux, libuuid, udev, keyutils, rdma-core, rabbitmq-c
|
2018-11-06 13:35:48 +00:00
|
|
|
, libaio ? null, libxfs ? null, zfs ? null
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
# We must have one crypto library
|
|
|
|
assert cryptopp != null || (nss != null && nspr != null);
|
|
|
|
|
|
|
|
with stdenv; with stdenv.lib;
|
|
|
|
let
|
|
|
|
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;
|
|
|
|
|
|
|
|
optYasm = shouldUsePkg yasm;
|
|
|
|
optFcgi = shouldUsePkg fcgi;
|
|
|
|
optExpat = shouldUsePkg expat;
|
|
|
|
optCurl = shouldUsePkg curl;
|
|
|
|
optFuse = shouldUsePkg fuse;
|
|
|
|
optLibedit = shouldUsePkg libedit;
|
|
|
|
optLibatomic_ops = shouldUsePkg libatomic_ops;
|
|
|
|
optLibs3 = shouldUsePkg libs3;
|
|
|
|
|
|
|
|
optJemalloc = shouldUsePkg jemalloc;
|
|
|
|
optGperftools = shouldUsePkg gperftools;
|
|
|
|
|
|
|
|
optCryptopp = shouldUsePkg cryptopp;
|
|
|
|
optNss = shouldUsePkg nss;
|
|
|
|
optNspr = shouldUsePkg nspr;
|
|
|
|
|
|
|
|
optLibaio = shouldUsePkg libaio;
|
|
|
|
optLibxfs = shouldUsePkg libxfs;
|
|
|
|
optZfs = shouldUsePkg zfs;
|
|
|
|
|
|
|
|
hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
|
|
|
|
|
|
|
|
|
|
|
|
# Malloc implementation (can be jemalloc, tcmalloc or null)
|
|
|
|
malloc = if optJemalloc != null then optJemalloc else optGperftools;
|
|
|
|
|
|
|
|
# We prefer nss over cryptopp
|
|
|
|
cryptoStr = if optNss != null && optNspr != null then "nss" else
|
|
|
|
if optCryptopp != null then "cryptopp" else "none";
|
|
|
|
|
|
|
|
cryptoLibsMap = {
|
|
|
|
nss = [ optNss optNspr ];
|
|
|
|
cryptopp = [ optCryptopp ];
|
|
|
|
none = [ ];
|
|
|
|
};
|
|
|
|
|
2020-07-07 09:56:04 +01:00
|
|
|
getMeta = description: {
|
|
|
|
homepage = "https://ceph.com/";
|
|
|
|
inherit description;
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ];
|
|
|
|
maintainers = with maintainers; [ adev ak johanot krav ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
ceph-common = python3Packages.buildPythonPackage rec{
|
|
|
|
pname = "ceph-common";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
sourceRoot = "ceph-${version}/src/python-common";
|
|
|
|
|
|
|
|
checkInputs = [ python3Packages.pytest ];
|
|
|
|
propagatedBuildInputs = with python3Packages; [ pyyaml six ];
|
|
|
|
|
|
|
|
meta = getMeta "Ceph common module for code shared by manager modules";
|
|
|
|
};
|
|
|
|
|
2019-06-14 11:46:07 +01:00
|
|
|
ceph-python-env = python3Packages.python.withPackages (ps: [
|
2018-11-06 13:35:48 +00:00
|
|
|
ps.sphinx
|
|
|
|
ps.flask
|
|
|
|
ps.cython
|
|
|
|
ps.setuptools
|
|
|
|
ps.virtualenv
|
|
|
|
# Libraries needed by the python tools
|
|
|
|
ps.Mako
|
2020-07-07 09:56:04 +01:00
|
|
|
ceph-common
|
2018-11-06 13:35:48 +00:00
|
|
|
ps.cherrypy
|
2020-07-07 09:56:04 +01:00
|
|
|
ps.dateutil
|
|
|
|
ps.jsonpatch
|
2018-11-06 13:35:48 +00:00
|
|
|
ps.pecan
|
|
|
|
ps.prettytable
|
2019-06-14 11:46:07 +01:00
|
|
|
ps.pyjwt
|
2018-11-06 13:35:48 +00:00
|
|
|
ps.webob
|
|
|
|
ps.bcrypt
|
2020-07-09 08:28:46 +01:00
|
|
|
# scipy > 1.3 breaks diskprediction_local, leading to mgr hang on startup
|
|
|
|
# Bump (and get rid of scipy_1_3) once these issues are resolved:
|
|
|
|
# https://tracker.ceph.com/issues/42764 https://tracker.ceph.com/issues/45147
|
|
|
|
ps.scipy_1_3
|
2019-06-14 11:46:07 +01:00
|
|
|
ps.six
|
2020-01-07 02:51:20 +00:00
|
|
|
ps.pyyaml
|
2018-11-06 13:35:48 +00:00
|
|
|
]);
|
2020-01-21 14:26:20 +00:00
|
|
|
sitePackages = ceph-python-env.python.sitePackages;
|
2018-11-06 13:35:48 +00:00
|
|
|
|
2020-09-24 22:44:54 +01:00
|
|
|
version = "15.2.5";
|
2020-07-07 09:56:04 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://download.ceph.com/tarballs/ceph-${version}.tar.gz";
|
2020-09-24 22:44:54 +01:00
|
|
|
sha256 = "05p7ssbfypf5x8bry361rrnyaihf89xzbqzhygdyrg7w1rxpna8d";
|
2020-07-07 09:56:04 +01:00
|
|
|
};
|
2018-11-06 13:35:48 +00:00
|
|
|
in rec {
|
|
|
|
ceph = stdenv.mkDerivation {
|
2019-09-05 11:48:15 +01:00
|
|
|
pname = "ceph";
|
2020-07-07 09:56:04 +01:00
|
|
|
inherit src version;
|
2018-11-06 13:35:48 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./0000-fix-SPDK-build-env.patch
|
2020-10-24 13:45:05 +01:00
|
|
|
./ceph-glibc-2-32-sigdescr_np.patch
|
2018-11-06 13:35:48 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2019-06-14 11:46:07 +01:00
|
|
|
pkgconfig which git python3Packages.wrapPython makeWrapper
|
2019-11-10 23:24:27 +00:00
|
|
|
python3Packages.python # for the toPythonPath function
|
2018-11-06 13:35:48 +00:00
|
|
|
(ensureNewerSourcesHook { year = "1980"; })
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = cryptoLibsMap.${cryptoStr} ++ [
|
|
|
|
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
|
2019-11-10 23:24:27 +00:00
|
|
|
malloc zlib openldap lttng-ust babeltrace gperf gtest cunit
|
2020-07-01 09:12:32 +01:00
|
|
|
snappy rocksdb lz4 oathToolkit leveldb libnl libcap_ng rdkafka
|
2018-11-06 13:35:48 +00:00
|
|
|
] ++ optionals stdenv.isLinux [
|
|
|
|
linuxHeaders utillinux libuuid udev keyutils optLibaio optLibxfs optZfs
|
2019-06-14 11:46:07 +01:00
|
|
|
# ceph 14
|
|
|
|
rdma-core rabbitmq-c
|
2018-11-06 13:35:48 +00:00
|
|
|
] ++ optionals hasRadosgw [
|
|
|
|
optFcgi optExpat optCurl optFuse optLibedit
|
|
|
|
];
|
|
|
|
|
2019-11-10 23:24:27 +00:00
|
|
|
pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ];
|
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
preConfigure =''
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo"
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe"
|
|
|
|
|
|
|
|
# for pybind/rgw to find internal dep
|
2020-01-02 00:29:34 +00:00
|
|
|
export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
|
2018-11-06 13:35:48 +00:00
|
|
|
# install target needs to be in PYTHONPATH for "*.pth support" check to succeed
|
2020-01-21 14:26:20 +00:00
|
|
|
# set PYTHONPATH, so the build system doesn't silently skip installing ceph-volume and others
|
|
|
|
export PYTHONPATH=${ceph-python-env}/${sitePackages}:$lib/${sitePackages}:$out/${sitePackages}
|
2019-11-10 23:24:27 +00:00
|
|
|
patchShebangs src/script src/spdk src/test src/tools
|
2018-11-06 13:35:48 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2019-06-14 11:46:07 +01:00
|
|
|
"-DWITH_PYTHON3=ON"
|
|
|
|
"-DWITH_SYSTEM_ROCKSDB=OFF"
|
2019-11-10 23:24:27 +00:00
|
|
|
"-DCMAKE_INSTALL_DATADIR=${placeholder "lib"}/lib"
|
|
|
|
|
2019-06-14 11:46:07 +01:00
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
"-DWITH_SYSTEM_BOOST=ON"
|
2019-11-10 23:24:27 +00:00
|
|
|
"-DWITH_SYSTEM_ROCKSDB=ON"
|
|
|
|
"-DWITH_SYSTEM_GTEST=ON"
|
|
|
|
"-DMGR_PYTHON_VERSION=${ceph-python-env.python.pythonVersion}"
|
2018-11-06 13:35:48 +00:00
|
|
|
"-DWITH_SYSTEMD=OFF"
|
|
|
|
"-DWITH_TESTS=OFF"
|
|
|
|
# TODO breaks with sandbox, tries to download stuff with npm
|
|
|
|
"-DWITH_MGR_DASHBOARD_FRONTEND=OFF"
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapPythonPrograms
|
2019-11-10 23:24:27 +00:00
|
|
|
wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "$(toPythonPath ${placeholder "out"}):$(toPythonPath ${ceph-python-env})"
|
2020-01-21 14:26:20 +00:00
|
|
|
|
|
|
|
# Test that ceph-volume exists since the build system has a tendency to
|
|
|
|
# silently drop it with misconfigurations.
|
|
|
|
test -f $out/bin/ceph-volume
|
2018-11-06 13:35:48 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
|
|
|
|
2019-11-10 23:24:27 +00:00
|
|
|
doCheck = false; # uses pip to install things from the internet
|
|
|
|
|
2020-07-07 09:56:04 +01:00
|
|
|
meta = getMeta "Distributed storage system";
|
2018-11-06 13:35:48 +00:00
|
|
|
|
|
|
|
passthru.version = version;
|
2015-11-19 13:21:07 +00:00
|
|
|
};
|
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
ceph-client = runCommand "ceph-client-${version}" {
|
2020-07-07 09:56:04 +01:00
|
|
|
meta = getMeta "Tools needed to mount Ceph's RADOS Block Devices";
|
2018-11-06 13:35:48 +00:00
|
|
|
} ''
|
2020-11-12 21:22:18 +00:00
|
|
|
mkdir -p $out/{bin,etc,${sitePackages},share/bash-completion/completions}
|
2018-11-06 13:35:48 +00:00
|
|
|
cp -r ${ceph}/bin/{ceph,.ceph-wrapped,rados,rbd,rbdmap} $out/bin
|
|
|
|
cp -r ${ceph}/bin/ceph-{authtool,conf,dencoder,rbdnamer,syn} $out/bin
|
|
|
|
cp -r ${ceph}/bin/rbd-replay* $out/bin
|
2020-01-21 14:26:20 +00:00
|
|
|
cp -r ${ceph}/${sitePackages} $out/${sitePackages}
|
2020-11-12 21:22:18 +00:00
|
|
|
cp -r ${ceph}/etc/bash_completion.d $out/share/bash-completion/completions
|
2018-11-06 13:35:48 +00:00
|
|
|
# wrapPythonPrograms modifies .ceph-wrapped, so lets just update its paths
|
|
|
|
substituteInPlace $out/bin/ceph --replace ${ceph} $out
|
|
|
|
substituteInPlace $out/bin/.ceph-wrapped --replace ${ceph} $out
|
|
|
|
'';
|
|
|
|
}
|