2018-11-06 13:35:48 +00:00
|
|
|
{ stdenv, runCommand, fetchurl
|
|
|
|
, ensureNewerSourcesHook
|
|
|
|
, cmake, pkgconfig
|
|
|
|
, which, git
|
2019-06-14 10:46:07 +00:00
|
|
|
, boost, python3Packages
|
2018-11-06 13:35:48 +00:00
|
|
|
, libxml2, zlib, lz4
|
|
|
|
, openldap, lttng-ust
|
|
|
|
, babeltrace, gperf
|
|
|
|
, cunit, snappy
|
|
|
|
, rocksdb, makeWrapper
|
2019-06-14 10:46:07 +00:00
|
|
|
, leveldb, oathToolkit, removeReferencesTo
|
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 10:46:07 +00: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 10:46:07 +00: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 = [ ];
|
|
|
|
};
|
|
|
|
|
2019-06-14 10:46:07 +00: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
|
|
|
|
ps.cherrypy
|
|
|
|
ps.pecan
|
|
|
|
ps.prettytable
|
2019-06-14 10:46:07 +00:00
|
|
|
ps.pyjwt
|
2018-11-06 13:35:48 +00:00
|
|
|
ps.webob
|
|
|
|
ps.bcrypt
|
2019-06-14 10:46:07 +00:00
|
|
|
ps.six
|
2018-11-06 13:35:48 +00:00
|
|
|
]);
|
|
|
|
|
2019-09-26 12:52:02 +00:00
|
|
|
version = "14.2.4";
|
2018-11-06 13:35:48 +00:00
|
|
|
in rec {
|
|
|
|
ceph = stdenv.mkDerivation {
|
2019-09-05 10:48:15 +00:00
|
|
|
pname = "ceph";
|
|
|
|
inherit version;
|
2018-11-06 13:35:48 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://download.ceph.com/tarballs/ceph-${version}.tar.gz";
|
2019-09-26 12:52:02 +00:00
|
|
|
sha256 = "1y6hixh6srd5aswhzq0sf0dbygwhx0ardx3w3f7qazf5rapvd03i";
|
2018-11-06 13:35:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./0000-fix-SPDK-build-env.patch
|
|
|
|
./0000-dont-check-cherrypy-version.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2019-06-14 10:46:07 +00:00
|
|
|
pkgconfig which git python3Packages.wrapPython makeWrapper
|
2018-11-06 13:35:48 +00:00
|
|
|
(ensureNewerSourcesHook { year = "1980"; })
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = cryptoLibsMap.${cryptoStr} ++ [
|
|
|
|
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
|
|
|
|
malloc zlib openldap lttng-ust babeltrace gperf cunit
|
|
|
|
snappy rocksdb lz4 oathToolkit leveldb
|
2019-06-14 10:46:07 +00:00
|
|
|
removeReferencesTo
|
2018-11-06 13:35:48 +00:00
|
|
|
] ++ optionals stdenv.isLinux [
|
|
|
|
linuxHeaders utillinux libuuid udev keyutils optLibaio optLibxfs optZfs
|
2019-06-14 10:46:07 +00:00
|
|
|
# ceph 14
|
|
|
|
rdma-core rabbitmq-c
|
2018-11-06 13:35:48 +00:00
|
|
|
] ++ optionals hasRadosgw [
|
|
|
|
optFcgi optExpat optCurl optFuse optLibedit
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure =''
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo"
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe"
|
|
|
|
# Since Boost 1.67 this seems to have changed
|
2019-06-14 10:46:07 +00:00
|
|
|
substituteInPlace CMakeLists.txt --replace "list(APPEND BOOST_COMPONENTS python)" "list(APPEND BOOST_COMPONENTS python37)"
|
|
|
|
substituteInPlace src/CMakeLists.txt --replace "Boost::python " "Boost::python37 "
|
2018-11-06 13:35:48 +00:00
|
|
|
|
|
|
|
# for pybind/rgw to find internal dep
|
|
|
|
export LD_LIBRARY_PATH="$PWD/build/lib:$LD_LIBRARY_PATH"
|
|
|
|
# install target needs to be in PYTHONPATH for "*.pth support" check to succeed
|
2019-06-14 10:46:07 +00:00
|
|
|
export PYTHONPATH=${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/python3.7/site-packages/:$out/lib/python3.7/site-packages/
|
2018-11-06 13:35:48 +00:00
|
|
|
|
|
|
|
patchShebangs src/spdk
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2019-06-14 10:46:07 +00:00
|
|
|
"-DWITH_PYTHON3=ON"
|
|
|
|
"-DWITH_SYSTEM_ROCKSDB=OFF"
|
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
"-DWITH_SYSTEM_BOOST=ON"
|
|
|
|
"-DWITH_SYSTEMD=OFF"
|
|
|
|
"-DWITH_TESTS=OFF"
|
|
|
|
# TODO breaks with sandbox, tries to download stuff with npm
|
|
|
|
"-DWITH_MGR_DASHBOARD_FRONTEND=OFF"
|
|
|
|
];
|
|
|
|
|
2019-06-14 10:46:07 +00:00
|
|
|
preFixup = ''
|
|
|
|
find $lib -type f -exec remove-references-to -t $out '{}' +
|
|
|
|
mv $out/share/ceph/mgr $lib/lib/ceph/
|
|
|
|
'';
|
|
|
|
|
2018-11-06 13:35:48 +00:00
|
|
|
postFixup = ''
|
2019-06-14 10:46:07 +00:00
|
|
|
export PYTHONPATH="${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/"
|
2018-11-06 13:35:48 +00:00
|
|
|
wrapPythonPrograms
|
2019-06-14 10:46:07 +00:00
|
|
|
wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/"
|
|
|
|
wrapProgram $out/bin/ceph-volume --prefix PYTHONPATH ":" "${ceph-python-env}/lib/python3.7/site-packages:$lib/lib/ceph/mgr:$out/lib/python3.7/site-packages/"
|
2018-11-06 13:35:48 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = https://ceph.com/;
|
|
|
|
description = "Distributed storage system";
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ];
|
2019-06-14 10:46:07 +00:00
|
|
|
maintainers = with maintainers; [ adev ak krav johanot ];
|
2018-11-06 13:35:48 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
|
|
|
|
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}" {
|
|
|
|
meta = {
|
|
|
|
homepage = https://ceph.com/;
|
|
|
|
description = "Tools needed to mount Ceph's RADOS Block Devices";
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ];
|
2019-09-05 10:48:15 +00:00
|
|
|
maintainers = with maintainers; [ adev ak johanot krav ];
|
2018-11-06 13:35:48 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
} ''
|
2019-06-14 10:46:07 +00:00
|
|
|
mkdir -p $out/{bin,etc,lib/python3.7/site-packages}
|
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
|
2019-06-14 10:46:07 +00:00
|
|
|
cp -r ${ceph}/lib/python3.7/site-packages $out/lib/python3.7/
|
2018-11-06 13:35:48 +00:00
|
|
|
cp -r ${ceph}/etc/bash_completion.d $out/etc
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
}
|