2021-04-29 07:22:39 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2021-07-27 14:35:38 +01:00
|
|
|
, python2
|
2021-04-29 07:22:39 +01:00
|
|
|
, makeWrapper
|
|
|
|
, gawk
|
|
|
|
, bash
|
|
|
|
, getopt
|
|
|
|
, procps
|
|
|
|
, which
|
|
|
|
, jre
|
|
|
|
, nixosTests
|
|
|
|
# generation is the attribute version suffix such as 3_11 in pkgs.cassandra_3_11
|
2020-12-09 12:01:56 +00:00
|
|
|
, generation
|
2021-04-29 07:22:39 +01:00
|
|
|
, version
|
|
|
|
, sha256
|
|
|
|
, extraMeta ? { }
|
2022-04-06 10:16:40 +01:00
|
|
|
, callPackage
|
2020-12-09 12:01:56 +00:00
|
|
|
, ...
|
2016-07-22 20:34:43 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-01-15 07:07:56 +00:00
|
|
|
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
|
2021-04-29 07:39:35 +01:00
|
|
|
binPath = lib.makeBinPath [
|
2016-10-06 20:45:11 +01:00
|
|
|
bash
|
|
|
|
getopt
|
|
|
|
gawk
|
|
|
|
which
|
|
|
|
jre
|
2018-03-26 05:01:31 +01:00
|
|
|
procps
|
2021-04-29 07:22:39 +01:00
|
|
|
];
|
2016-07-22 20:34:43 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cassandra";
|
2017-11-07 13:11:56 +00:00
|
|
|
inherit version;
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
inherit sha256;
|
2022-02-23 14:31:16 +00:00
|
|
|
url = "mirror://apache/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz";
|
2016-07-22 20:34:43 +01:00
|
|
|
};
|
|
|
|
|
2022-03-31 19:11:26 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-02-18 11:17:30 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2016-07-22 20:34:43 +01:00
|
|
|
mkdir $out
|
|
|
|
mv * $out
|
2017-08-16 14:22:27 +01:00
|
|
|
|
|
|
|
# Clean up documentation.
|
2019-08-15 13:41:18 +01:00
|
|
|
mkdir -p $out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
mv $out/CHANGES.txt \
|
|
|
|
$out/LICENSE.txt \
|
|
|
|
$out/NEWS.txt \
|
|
|
|
$out/NOTICE.txt \
|
2019-08-15 13:41:18 +01:00
|
|
|
$out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
|
|
|
|
if [[ -d $out/doc ]]; then
|
2019-08-15 13:41:18 +01:00
|
|
|
mv "$out/doc/"* $out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
rmdir $out/doc
|
|
|
|
fi
|
|
|
|
|
2019-04-07 14:53:57 +01:00
|
|
|
|
|
|
|
for cmd in bin/cassandra \
|
|
|
|
bin/nodetool \
|
|
|
|
bin/sstablekeys \
|
|
|
|
bin/sstableloader \
|
|
|
|
bin/sstablescrub \
|
|
|
|
bin/sstableupgrade \
|
|
|
|
bin/sstableutil \
|
2019-04-09 05:31:55 +01:00
|
|
|
bin/sstableverify; do
|
|
|
|
# Check if file exists because some don't exist across all versions
|
|
|
|
if [ -f $out/$cmd ]; then
|
|
|
|
wrapProgram $out/bin/$(basename "$cmd") \
|
|
|
|
--suffix-each LD_LIBRARY_PATH : ${libPath} \
|
|
|
|
--prefix PATH : ${binPath} \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for cmd in tools/bin/cassandra-stress \
|
2019-04-07 14:53:57 +01:00
|
|
|
tools/bin/cassandra-stressd \
|
|
|
|
tools/bin/sstabledump \
|
|
|
|
tools/bin/sstableexpiredblockers \
|
|
|
|
tools/bin/sstablelevelreset \
|
|
|
|
tools/bin/sstablemetadata \
|
|
|
|
tools/bin/sstableofflinerelevel \
|
|
|
|
tools/bin/sstablerepairedset \
|
|
|
|
tools/bin/sstablesplit \
|
|
|
|
tools/bin/token-generator; do
|
2019-04-09 05:31:55 +01:00
|
|
|
# Check if file exists because some don't exist across all versions
|
2016-07-22 20:34:43 +01:00
|
|
|
if [ -f $out/$cmd ]; then
|
2019-04-09 05:31:55 +01:00
|
|
|
makeWrapper $out/$cmd $out/bin/$(basename "$cmd") \
|
2016-07-22 20:34:43 +01:00
|
|
|
--suffix-each LD_LIBRARY_PATH : ${libPath} \
|
|
|
|
--prefix PATH : ${binPath} \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-07-27 14:35:38 +01:00
|
|
|
wrapProgram $out/bin/cqlsh --prefix PATH : ${python2}/bin
|
2021-02-18 11:17:30 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-04-29 07:22:39 +01:00
|
|
|
'';
|
2016-07-22 20:34:43 +01:00
|
|
|
|
2020-12-09 12:01:56 +00:00
|
|
|
passthru = {
|
|
|
|
tests =
|
|
|
|
let
|
|
|
|
test = nixosTests."cassandra_${generation}";
|
2021-04-29 07:22:39 +01:00
|
|
|
in
|
|
|
|
{
|
2020-12-09 12:01:56 +00:00
|
|
|
nixos =
|
|
|
|
assert test.testPackage.version == version;
|
|
|
|
test;
|
|
|
|
};
|
2022-02-23 14:31:16 +00:00
|
|
|
|
2022-04-06 10:16:40 +01:00
|
|
|
updateScript = callPackage ./update-script.nix { inherit generation; };
|
2020-12-09 12:01:56 +00:00
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2022-01-03 15:53:12 +00:00
|
|
|
homepage = "https://cassandra.apache.org/";
|
2016-07-22 20:34:43 +01:00
|
|
|
description = "A massively scalable open source NoSQL database";
|
2016-10-06 20:45:11 +01:00
|
|
|
platforms = platforms.unix;
|
2016-07-22 20:34:43 +01:00
|
|
|
license = licenses.asl20;
|
2020-12-14 14:37:46 +00:00
|
|
|
maintainers = [ maintainers.roberth ];
|
2021-02-18 10:44:25 +00:00
|
|
|
} // extraMeta;
|
2016-07-22 20:34:43 +01:00
|
|
|
}
|