2021-04-29 06:22:39 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2024-09-16 11:34:02 +00:00
|
|
|
, python311Packages
|
2021-04-29 06:22:39 +00: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 06:22:39 +00:00
|
|
|
, version
|
|
|
|
, sha256
|
|
|
|
, extraMeta ? { }
|
2022-04-06 09:16:40 +00:00
|
|
|
, callPackage
|
2020-12-09 12:01:56 +00:00
|
|
|
, ...
|
2016-07-22 19:34:43 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-01-15 07:07:56 +00:00
|
|
|
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
|
2021-04-29 06:39:35 +00:00
|
|
|
binPath = lib.makeBinPath [
|
2016-10-06 19:45:11 +00:00
|
|
|
bash
|
|
|
|
getopt
|
|
|
|
gawk
|
|
|
|
which
|
|
|
|
jre
|
2018-03-26 04:01:31 +00:00
|
|
|
procps
|
2021-04-29 06:22:39 +00:00
|
|
|
];
|
2016-07-22 19:34:43 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "cassandra";
|
2017-11-07 13:11:56 +00:00
|
|
|
inherit version;
|
2016-07-22 19:34:43 +00: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 19:34:43 +00:00
|
|
|
};
|
|
|
|
|
2024-09-16 11:34:02 +00:00
|
|
|
pythonPath = with python311Packages; [ cassandra-driver ];
|
2024-08-16 11:03:23 +00:00
|
|
|
|
2024-09-16 11:34:02 +00:00
|
|
|
nativeBuildInputs = [ python311Packages.wrapPython ];
|
2024-08-16 11:03:23 +00:00
|
|
|
|
2024-09-16 11:34:02 +00:00
|
|
|
buildInputs = [ python311Packages.python ] ++ pythonPath;
|
2016-07-22 19:34:43 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-02-18 11:17:30 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2016-07-22 19:34:43 +00:00
|
|
|
mkdir $out
|
|
|
|
mv * $out
|
2017-08-16 13:22:27 +00:00
|
|
|
|
|
|
|
# Clean up documentation.
|
2019-08-15 12:41:18 +00:00
|
|
|
mkdir -p $out/share/doc/${pname}-${version}
|
2017-08-16 13:22:27 +00:00
|
|
|
mv $out/CHANGES.txt \
|
|
|
|
$out/LICENSE.txt \
|
|
|
|
$out/NEWS.txt \
|
|
|
|
$out/NOTICE.txt \
|
2019-08-15 12:41:18 +00:00
|
|
|
$out/share/doc/${pname}-${version}
|
2017-08-16 13:22:27 +00:00
|
|
|
|
|
|
|
if [[ -d $out/doc ]]; then
|
2019-08-15 12:41:18 +00:00
|
|
|
mv "$out/doc/"* $out/share/doc/${pname}-${version}
|
2017-08-16 13:22:27 +00:00
|
|
|
rmdir $out/doc
|
|
|
|
fi
|
|
|
|
|
2019-04-07 13:53:57 +00:00
|
|
|
|
|
|
|
for cmd in bin/cassandra \
|
|
|
|
bin/nodetool \
|
|
|
|
bin/sstablekeys \
|
|
|
|
bin/sstableloader \
|
|
|
|
bin/sstablescrub \
|
|
|
|
bin/sstableupgrade \
|
|
|
|
bin/sstableutil \
|
2019-04-09 04:31:55 +00: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 13:53:57 +00: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 04:31:55 +00:00
|
|
|
# Check if file exists because some don't exist across all versions
|
2016-07-22 19:34:43 +00:00
|
|
|
if [ -f $out/$cmd ]; then
|
2019-04-09 04:31:55 +00:00
|
|
|
makeWrapper $out/$cmd $out/bin/$(basename "$cmd") \
|
2016-07-22 19:34:43 +00:00
|
|
|
--suffix-each LD_LIBRARY_PATH : ${libPath} \
|
|
|
|
--prefix PATH : ${binPath} \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-02-18 11:17:30 +00:00
|
|
|
runHook postInstall
|
2021-04-29 06:22:39 +00:00
|
|
|
'';
|
2016-07-22 19:34:43 +00:00
|
|
|
|
2024-08-16 11:03:23 +00:00
|
|
|
postFixup = ''
|
|
|
|
# Remove cassandra bash script wrapper.
|
|
|
|
# The wrapper searches for a suitable python version and is not necessary with Nix.
|
|
|
|
rm $out/bin/cqlsh
|
|
|
|
# Make "cqlsh.py" accessible by invoking "cqlsh"
|
|
|
|
ln -s $out/bin/cqlsh.py $out/bin/cqlsh
|
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
|
|
|
|
2020-12-09 12:01:56 +00:00
|
|
|
passthru = {
|
|
|
|
tests =
|
|
|
|
let
|
|
|
|
test = nixosTests."cassandra_${generation}";
|
2021-04-29 06:22:39 +00: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 09:16:40 +00: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 19:34:43 +00:00
|
|
|
description = "Massively scalable open source NoSQL database";
|
2016-10-06 19:45:11 +00:00
|
|
|
platforms = platforms.unix;
|
2016-07-22 19:34:43 +00:00
|
|
|
license = licenses.asl20;
|
2024-08-12 18:48:45 +00:00
|
|
|
sourceProvenance = with sourceTypes; [
|
|
|
|
binaryBytecode
|
|
|
|
binaryNativeCode # bundled dependency libsigar
|
|
|
|
];
|
2020-12-14 14:37:46 +00:00
|
|
|
maintainers = [ maintainers.roberth ];
|
2021-02-18 10:44:25 +00:00
|
|
|
} // extraMeta;
|
2016-07-22 19:34:43 +00:00
|
|
|
}
|