cassandra: fix cqlsh not working

Fixes #329864
This commit is contained in:
Pierre Allix 2024-08-16 13:03:23 +02:00
parent 752842bfa4
commit 3876bf529f

View File

@ -1,7 +1,7 @@
{ lib
, stdenv
, fetchurl
, python
, python3Packages
, makeWrapper
, gawk
, bash
@ -40,7 +40,11 @@ stdenv.mkDerivation rec {
url = "mirror://apache/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz";
};
nativeBuildInputs = [ makeWrapper ];
pythonPath = with python3Packages; [ cassandra-driver ];
nativeBuildInputs = [ python3Packages.wrapPython ];
buildInputs = [ python3Packages.python ] ++ pythonPath;
installPhase = ''
runHook preInstall
@ -98,11 +102,18 @@ stdenv.mkDerivation rec {
fi
done
wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin
runHook postInstall
'';
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
'';
passthru = {
tests =
let