cassandra: fix cqlsh not working (#335084)

This commit is contained in:
Aleksana 2024-09-16 22:07:12 +08:00 committed by GitHub
commit 38aad8a814
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
{ lib
, stdenv
, fetchurl
, python
, python311Packages
, 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 python311Packages; [ cassandra-driver ];
nativeBuildInputs = [ python311Packages.wrapPython ];
buildInputs = [ python311Packages.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