summary refs log tree commit diff
path: root/pkgs/development/tools/repository-managers
diff options
context:
space:
mode:
authorMichele Catalano <michele.catalano@mayflower.de>2017-09-01 18:19:27 +0200
committerRobin Gloster <mail@glob.in>2017-09-04 22:32:02 +0200
commite783c2b39cfcfa5d3994e774357404f87097aa82 (patch)
tree1bdbb1c56b9eedf8ab73c93c7cc623b39a47574a /pkgs/development/tools/repository-managers
parent11cd027b306057f75806b4f9a108fcf8a856601f (diff)
downloadnixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar.gz
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar.bz2
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar.lz
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar.xz
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.tar.zst
nixpkgs-e783c2b39cfcfa5d3994e774357404f87097aa82.zip
nexus: 2.12.0-01 -> 3.5.1-02
Update Nexus to version 3.5.1-02 and fix startup stript to run in nix
environment.
Diffstat (limited to 'pkgs/development/tools/repository-managers')
-rw-r--r--pkgs/development/tools/repository-managers/nexus/default.nix43
-rw-r--r--pkgs/development/tools/repository-managers/nexus/nexus-bin.patch54
2 files changed, 85 insertions, 12 deletions
diff --git a/pkgs/development/tools/repository-managers/nexus/default.nix b/pkgs/development/tools/repository-managers/nexus/default.nix
index 1b2f48b696c..25dba0ac02f 100644
--- a/pkgs/development/tools/repository-managers/nexus/default.nix
+++ b/pkgs/development/tools/repository-managers/nexus/default.nix
@@ -1,29 +1,48 @@
-{ stdenv, fetchurl, makeWrapper, jre }:
+{ stdenv, fetchurl, makeWrapper, jre, gawk }:
 stdenv.mkDerivation rec {
   name = "nexus-${version}";
-  version = "2.12.0-01";
+  version = "3.5.1-02";
 
   src = fetchurl {
-    url = "https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-${version}-bundle.tar.gz";
-    sha256 = "1k3z7kwcmr1pxaxfnak99fq5s8br9zbqbfpyw1afi86ykkph4g5z";
+    url = "https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-${version}-mac.tgz";
+    sha256 = "5ef3512c2bbdd45ef35921c1a0ba109b45bd9dad88311750196aa689262258b6";
   };
 
   sourceRoot = name;
 
-  buildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ makeWrapper ];
 
-  installPhase = 
-    ''
-      mkdir -p $out
-      cp -rfv * $out
-      rm -fv $out/bin/nexus.bat
-    '';
+  patches = [ ./nexus-bin.patch ];
+
+  postPatch = ''
+    substituteInPlace bin/nexus.vmoptions \
+      --replace ../sonatype-work/nexus3 /run/sonatype-work/nexus3 \
+      --replace etc/karaf $out/etc/karaf \
+      --replace =. =$out
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    cp -rfv * .install4j $out
+    rm -fv $out/bin/nexus.bat
+
+    runHook postInstall
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/nexus \
+      --set JAVA_HOME ${jre} \
+      --set ALTERNATIVE_NAME "nexus" \
+      --prefix PATH "${stdenv.lib.makeBinPath [ gawk ]}"
+  '';
 
   meta = with stdenv.lib; {
     description = "Repository manager for binary software components";
     homepage = http://www.sonatype.org/nexus;
     license = licenses.epl10;
     platforms = platforms.all;
-    maintainers = [ maintainers.aespinosa ];
+    maintainers = with maintainers; [ aespinosa ironpinguin ];
   };
 }
diff --git a/pkgs/development/tools/repository-managers/nexus/nexus-bin.patch b/pkgs/development/tools/repository-managers/nexus/nexus-bin.patch
new file mode 100644
index 00000000000..ce6ecc4a4c9
--- /dev/null
+++ b/pkgs/development/tools/repository-managers/nexus/nexus-bin.patch
@@ -0,0 +1,54 @@
+--- nexus-3.5.1-02/bin/nexus	2017-08-18 17:51:08.000000000 +0200
++++ nexus	2017-08-31 12:41:01.271475645 +0200
+@@ -72,7 +72,7 @@
+   fi
+   db_new_file=${db_file}_new
+   if [ -f "$db_file" ]; then
+-    awk '$1 != "'"$test_dir"'" {print $0}' $db_file > $db_new_file
++    awk '$1 != "'"$test_dir"'" {print $scriptname}' $db_file > $db_new_file
+     rm "$db_file"
+     mv "$db_new_file" "$db_file"
+   fi
+@@ -236,7 +236,7 @@
+ 
+ unpack_file() {
+   if [ -f "$1" ]; then
+-    jar_file=`echo "$1" | awk '{ print substr($0,1,length-5) }'`
++    jar_file=`echo "$1" | awk '{ print substr($scriptname,1,length-5) }'`
+     bin/unpack200 -r "$1" "$jar_file"
+ 
+     if [ $? -ne 0 ]; then
+@@ -360,8 +360,14 @@
+ 
+ old_pwd=`pwd`
+ 
+-progname=`basename "$0"`
+-linkdir=`dirname "$0"`
++scriptname=$0
++
++if [ ! -z "$ALTERNATIVE_NAME" ]; then
++  scriptname=`dirname "$0"`"/"$ALTERNATIVE_NAME
++fi
++
++progname=`basename "$scriptname"`
++linkdir=`dirname "$scriptname"`
+ 
+ cd "$linkdir"
+ prg="$progname"
+@@ -522,7 +528,6 @@
+ 
+ $INSTALL4J_JAVA_PREFIX nohup "$app_java_home/bin/java" -server -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" "-XX:+UnlockDiagnosticVMOptions" "-Dinstall4j.launcherId=245" "-Dinstall4j.swt=false" "$vmov_1" "$vmov_2" "$vmov_3" "$vmov_4" "$vmov_5" $INSTALL4J_ADD_VM_PARAMS -classpath "$local_classpath" com.install4j.runtime.launcher.UnixLauncher start 9d17dc87 "" "" org.sonatype.nexus.karaf.NexusMain  > /dev/null 2>&1 &
+ 
+-
+     ;;
+     start-launchd)
+         echo "Starting nexus"
+@@ -569,7 +574,7 @@
+ 
+     ;;
+     *)
+-        echo "Usage: $0 {start|stop|run|run-redirect|status|restart|force-reload}"
++        echo "Usage: $scriptname {start|stop|run|run-redirect|status|restart|force-reload}"
+         exit 1
+     ;;
+ esac