From c4b1bbc1c8f75a3378c32385c2c25c86300a1db8 Mon Sep 17 00:00:00 2001 From: Danny Wilson Date: Thu, 14 Feb 2013 09:58:49 +0100 Subject: [PATCH] Improved Storm package. - Add config to defaults.yaml, to allow topologies to include their own storm.yaml. - Symlink extra jars in lib/ since it's nearly impossible to add a classpath to Storm's config. - Include native jzmq library in java.library.path - Use package default args. --- pkgs/servers/computing/storm/default.nix | 22 +++++++++++++++++----- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/servers/computing/storm/default.nix b/pkgs/servers/computing/storm/default.nix index b60d9fe62b25..2b7efff5210e 100644 --- a/pkgs/servers/computing/storm/default.nix +++ b/pkgs/servers/computing/storm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, unzip, jzmq, jdk, lib, python, logsDir, confDir }: +{ stdenv, fetchurl, zip, unzip, jzmq, jdk, lib, python, logsDir ? "", confFile ? "", extraLibraryPaths ? [], extraJars ? [] }: stdenv.mkDerivation { name = "storm-0.8.2"; @@ -7,7 +7,7 @@ stdenv.mkDerivation { sha256 = "8761aea0b54e5bab4a68b259bbe6b5b2f8226204488b5559eba57a0c458b2bbc"; }; - buildInputs = [ unzip jzmq ]; + buildInputs = [ zip unzip jzmq ]; installPhase = '' # Remove junk @@ -19,11 +19,23 @@ stdenv.mkDerivation { # Fix shebang header for python scripts sed -i -e "s|#!/usr/bin/.*python|#!${python}/bin/python|" $out/bin/storm; - mkdir -p $out + mkdir -p $out/conf cp -av * $out + cd $out; - ${if logsDir != "" then ''ln -s ${logsDir} logs'' else ""} - ${if confDir != "" then ''ln -s ${confDir} conf'' else ""} + ${if logsDir != "" then ''ln -s ${logsDir} logs'' else ""} + + # Extract, delete from zip; and optionally append to defaults.yaml + unzip storm-*.jar defaults.yaml; + zip -d storm-*.jar defaults.yaml; + echo 'java.library.path: "${jzmq}/lib:${lib.concatStringsSep ":" extraLibraryPaths}"' >> defaults.yaml; + ${if confFile != "" then ''cat ${confFile} >> defaults.yaml'' else ""} + mv defaults.yaml conf; + + # Link to jzmq jar and extra jars + cd lib; + ln ${jzmq}/share/java/*.jar; + ${lib.concatMapStrings (jar: "ln -s ${jar};\n") extraJars} ''; dontStrip = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 09c498a14bd3..2710098375a3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6170,7 +6170,7 @@ let thttpd = callPackage ../servers/http/thttpd { }; - storm = callPackage ../servers/computing/storm { confDir = "/etc/storm"; logsDir = "/var/log"; }; + storm = callPackage ../servers/computing/storm { }; tomcat5 = callPackage ../servers/http/tomcat/5.0.nix { };