diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2017-06-12 16:29:07 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2017-06-12 16:37:54 +0300 |
commit | eedce5a106721e0d1e0275ba28af0f5ee0a5da62 (patch) | |
tree | 50e1b7a26486062515ce884dd6d8553bfd4f99f9 /modules/pkgs | |
parent | 85ea46e3b26ce572d27fb4fbaea57ab06a7a845d (diff) | |
download | nixsap-eedce5a106721e0d1e0275ba28af0f5ee0a5da62.tar.gz |
Apache Cassandra: init
Add the `nixsap.apps.cassandra` application and Apache
Cassandra 3.11 package along with Hyperic Sigar.
The application runs in single node mode just fine.
Clustering is not tested yet.
This is PoC on Java applications.
A Java application should comprise:
1. JRE
2. Class path
3. Library path
A Java "package" should include all jar/classes/libraries
needed to run the application. Using symbolic links to
pull in dependencies is fine. This is much similar to nix
"environments". Apache Cassandra is the first example of
this approach.
Using $out/share/java/ and $out/lib/jni is to help building
such environments (also with nix-env).
Diffstat (limited to 'modules/pkgs')
-rw-r--r-- | modules/pkgs/cassandra3/default.nix | 39 | ||||
-rw-r--r-- | modules/pkgs/hyperic-sigar/default.nix | 34 |
2 files changed, 73 insertions, 0 deletions
diff --git a/modules/pkgs/cassandra3/default.nix b/modules/pkgs/cassandra3/default.nix new file mode 100644 index 0000000..467f665 --- /dev/null +++ b/modules/pkgs/cassandra3/default.nix @@ -0,0 +1,39 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + version = "3.11"; + name = "cassandra-${version}"; + + src = pkgs.fetchgit { + url = "https://git-wip-us.apache.org/repos/asf/cassandra.git"; + rev = "30412b08c0eb4a5cc5296725c7359f2741483ea2"; + sha256 = "0a5xgsgd5a91qckh4i40bxa6w9fw4bry0cqa3aj2hc7friwj199s"; + }; + + buildInputs = with pkgs; [ ant jdk ]; + + patches = [ + ]; + + configurePhase = '' + rm -rfv lib/*sigar* + cp --symbolic-link -fv ${pkgs.hyperic-sigar}/share/java/* lib/ + ''; + + buildPhase = '' + ant jar + ''; + + installPhase = '' + mkdir -p $out/lib/jni + mkdir -p $out/share/java + + cp -v lib/*.jar $out/share/java/ + cp -v lib/*.zip $out/share/java/ + cp -v build/apache-cassandra*.jar $out/share/java/ + + cp --symbolic-link -fv ${pkgs.hyperic-sigar}/share/java/* $out/share/java/ + cp --symbolic-link -fv ${pkgs.hyperic-sigar}/lib/jni/* $out/lib/jni/ + + ''; +} diff --git a/modules/pkgs/hyperic-sigar/default.nix b/modules/pkgs/hyperic-sigar/default.nix new file mode 100644 index 0000000..1251244 --- /dev/null +++ b/modules/pkgs/hyperic-sigar/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl, ant, jdk, perl }: + +stdenv.mkDerivation rec { + name = "hyperic-sigar-${version}"; + version = "1.6.4"; + + src = fetchurl { + url = "https://github.com/hyperic/sigar/archive/sigar-${version}.tar.gz"; + sha256 = "0bh5l1wzmv464v3np5zjb59d7i0vbk9ciy71683fa43yxg0h96qp"; + }; + + nativeBuildInputs = [ ant jdk perl ]; + buildInputs = [ ]; + + configurePhase = ":"; + + buildPhase = '' + cd bindings/java + ant build + ''; + + installPhase = '' + mkdir -p $out/{lib/jni,share/java} + cp sigar-bin/lib/sigar.jar $out/share/java/ + cp sigar-bin/lib/libsigar-* $out/lib/jni/ + ''; + + meta = with stdenv.lib; { + description = "System Information Gatherer And Reporter"; + license = licenses.asl20; + platforms = platforms.unix; + }; +} + |