diff --git a/pkgs/servers/nosql/cassandra/1.2.nix b/pkgs/servers/nosql/cassandra/1.2.nix index 8380a21b2cac..87cb4a11f9ab 100644 --- a/pkgs/servers/nosql/cassandra/1.2.nix +++ b/pkgs/servers/nosql/cassandra/1.2.nix @@ -1,52 +1,6 @@ -{ stdenv -, fetchurl -, jre -, python -, makeWrapper -, gawk -, bash -, getopt -, procps -}: - -let +{ callPackage, ... } @ args: +callPackage ./generic.nix (args // { version = "1.2.19"; sha256 = "0zkq3ggpk8ra2siar43vmrn6lmvn902p1g2lrgb46ak1vii6w30w"; - -in - -stdenv.mkDerivation rec { - name = "cassandra-${version}"; - - src = fetchurl { - inherit sha256; - url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir $out - mv * $out - - for cmd in cassandra nodetool sstablekeys sstableloader sstableupgrade - do wrapProgram $out/bin/$cmd \ - --set JAVA_HOME ${jre} \ - --prefix PATH : ${bash}/bin \ - --prefix PATH : ${getopt}/bin \ - --prefix PATH : ${gawk}/bin \ - --prefix PATH : ${procps}/bin - done - - wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin - ''; - - meta = with stdenv.lib; { - homepage = http://cassandra.apache.org/; - description = "A massively scalable open source NoSQL database"; - platforms = platforms.all; - license = licenses.asl20; - maintainers = with maintainers; [ bcarrell ]; - }; -} +}) diff --git a/pkgs/servers/nosql/cassandra/2.0.nix b/pkgs/servers/nosql/cassandra/2.0.nix index 026ae476691d..68bee0c124ba 100644 --- a/pkgs/servers/nosql/cassandra/2.0.nix +++ b/pkgs/servers/nosql/cassandra/2.0.nix @@ -1,52 +1,6 @@ -{ stdenv -, fetchurl -, jre -, python -, makeWrapper -, gawk -, bash -, getopt -, procps -}: - -let +{ callPackage, ... } @ args: +callPackage ./generic.nix (args // { version = "2.0.16"; sha256 = "1fpvgmakmxy1lnygccpc32q53pa36bwy0lqdvb6hsifkxymdw8y5"; - -in - -stdenv.mkDerivation rec { - name = "cassandra-${version}"; - - src = fetchurl { - inherit sha256; - url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir $out - mv * $out - - for cmd in cassandra nodetool sstablekeys sstableloader sstableupgrade - do wrapProgram $out/bin/$cmd \ - --set JAVA_HOME ${jre} \ - --prefix PATH : ${bash}/bin \ - --prefix PATH : ${getopt}/bin \ - --prefix PATH : ${gawk}/bin \ - --prefix PATH : ${procps}/bin - done - - wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin - ''; - - meta = with stdenv.lib; { - homepage = http://cassandra.apache.org/; - description = "A massively scalable open source NoSQL database"; - platforms = platforms.all; - license = licenses.asl20; - maintainers = with maintainers; [ nckx rushmorem ]; - }; -} +}) diff --git a/pkgs/servers/nosql/cassandra/2.1.nix b/pkgs/servers/nosql/cassandra/2.1.nix index 5e9a57bfe55b..3514ae84350d 100644 --- a/pkgs/servers/nosql/cassandra/2.1.nix +++ b/pkgs/servers/nosql/cassandra/2.1.nix @@ -1,52 +1,6 @@ -{ stdenv -, fetchurl -, jre -, python -, makeWrapper -, gawk -, bash -, getopt -, procps -}: - -let +{ callPackage, ... } @ args: +callPackage ./generic.nix (args // { version = "2.1.15"; sha256 = "1yc6r4gmxz9c4zghzn6bz5wswz7dz61w7p4x9s5gqnixfp2mlapp"; - -in - -stdenv.mkDerivation rec { - name = "cassandra-${version}"; - - src = fetchurl { - inherit sha256; - url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir $out - mv * $out - - for cmd in cassandra nodetool sstablekeys sstableloader sstableupgrade - do wrapProgram $out/bin/$cmd \ - --set JAVA_HOME ${jre} \ - --prefix PATH : ${bash}/bin \ - --prefix PATH : ${getopt}/bin \ - --prefix PATH : ${gawk}/bin \ - --prefix PATH : ${procps}/bin - done - - wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin - ''; - - meta = with stdenv.lib; { - homepage = http://cassandra.apache.org/; - description = "A massively scalable open source NoSQL database"; - platforms = platforms.all; - license = licenses.asl20; - maintainers = with maintainers; [ nckx rushmorem ]; - }; -} +}) diff --git a/pkgs/servers/nosql/cassandra/3.0.nix b/pkgs/servers/nosql/cassandra/3.0.nix index 68c2815ddd3b..b0975c7a93c0 100644 --- a/pkgs/servers/nosql/cassandra/3.0.nix +++ b/pkgs/servers/nosql/cassandra/3.0.nix @@ -1,49 +1,6 @@ -{ stdenv -, fetchurl -, jre -, python -, makeWrapper -, gawk -, bash -, getopt -, procps -}: - -let +{ callPackage, ... } @ args: +callPackage ./generic.nix (args // { version = "3.0.8"; sha256 = "02chk8q3pbl0y6rijfk2gbd0p1ani8daypsx9m9ingqkdx8ajljq"; - -in - -stdenv.mkDerivation rec { - name = "cassandra-${version}"; - - src = fetchurl { - inherit sha256; - url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir $out - mv * $out - - for cmd in cassandra nodetool sstableloader sstableupgrade - do wrapProgram $out/bin/$cmd \ - --set JAVA_HOME ${jre} \ - --prefix PATH : ${stdenv.lib.makeBinPath [ bash getopt gawk procps ]} - done - - wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin - ''; - - meta = with stdenv.lib; { - homepage = http://cassandra.apache.org/; - description = "A massively scalable open source NoSQL database"; - platforms = platforms.all; - license = licenses.asl20; - maintainers = with maintainers; [ nckx rushmorem ]; - }; -} +}) diff --git a/pkgs/servers/nosql/cassandra/generic.nix b/pkgs/servers/nosql/cassandra/generic.nix new file mode 100644 index 000000000000..5e364ba3e689 --- /dev/null +++ b/pkgs/servers/nosql/cassandra/generic.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, python, makeWrapper, gawk, bash, getopt, procps +, which, jre, version, sha256, ... +}: + +let + libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]; + binPath = stdenv.lib.makeBinPath [ bash getopt gawk procps which jre ]; +in + +stdenv.mkDerivation rec { + name = "cassandra-${version}"; + + src = fetchurl { + inherit sha256; + url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir $out + mv * $out + for cmd in bin/cassandra bin/nodetool bin/sstablekeys \ + bin/sstableloader bin/sstableupgrade \ + tools/bin/cassandra-stress tools/bin/cassandra-stressd \ + tools/bin/sstablemetadata tools/bin/sstableofflinerelevel \ + tools/bin/token-generator tools/bin/sstablelevelreset; do + + # check if file exists because some bin tools don't exist across all + # cassandra versions + if [ -f $out/$cmd ]; then + wrapProgram $out/$cmd \ + --suffix-each LD_LIBRARY_PATH : ${libPath} \ + --prefix PATH : ${binPath} \ + --set JAVA_HOME ${jre} + fi + done + + wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin + ''; + + meta = with stdenv.lib; { + homepage = http://cassandra.apache.org/; + description = "A massively scalable open source NoSQL database"; + platforms = platforms.linux; + license = licenses.asl20; + maintainers = with maintainers; [ nckx rushmorem cransom ]; + }; +}