Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nexus: 3.52.0-01 -> 3.62.0-01 #271120

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
113 changes: 92 additions & 21 deletions pkgs/development/tools/repository-managers/nexus/default.nix
@@ -1,50 +1,121 @@
{ lib, stdenv, fetchurl, makeWrapper, jre_headless, gawk }:
{ lib
, stdenv
, fetchFromGitHub
, maven
, git
, nodejs
, nodePackages
, python3
, makeWrapper
, prefetch-yarn-deps
, fetchYarnDeps
, buildNpmPackage
, mkYarnModules
, yarn
, jre_headless
, gawk
}:

stdenv.mkDerivation rec {
pname = "nexus";
version = "3.52.0-01";
let
version = "3.62.0-01";

src = fetchFromGitHub {
owner = "sonatype";
repo = "nexus-public";
rev = "tags/release-${version}";
hash = "sha256-tzBOs9Fdhq6kY2pY259gDosxHwUrvsYZliPTUtnzuNA=";
};

src = fetchurl {
url = "https://download.sonatype.com/nexus/3/nexus-${version}-unix.tar.gz";
hash = "sha256-+Hdmuy7WBtUIjEBZyLgE3a3+L/lANHiy1VRBJ2s686U=";
offline-cache = fetchYarnDeps {
# this yarn.lock is generated by running yarn in the root directory of the
# src. We cannot use the upstream yarn.lock, as yarn2nix only supports yarn
# v1 syntax.
yarnLock = ./yarn.lock;
hash = "sha256-M+6365ZWPPPSvEanpWqc9J9JxLb5jQujvhSQeeXRzVU=";
};
in
maven.buildMavenPackage rec {
pname = "nexus";
inherit version;
inherit src;

mvnHash = "sha256-O8lvb/ZPiFX0E+HiZKBjZtbS7URtMbmWab+aMNyed4o=";

mvnFetchExtraArgs = {

preferLocalBuild = true;
nativeBuildInputs = [
git
];

sourceRoot = "${pname}-${version}";
postPatch = ''
# disable yarn during the fetch stage
substituteInPlace pom.xml \
--replace "<goal>yarn</goal>" " "
substituteInPlace plugins/nexus-coreui-plugin/pom.xml \
--replace "<goal>yarn</goal>" " "
'';

nativeBuildInputs = [ makeWrapper ];
};
mvnParameters = "-Dmaven.test.skip=true";

patches = [ ./nexus-bin.patch ./nexus-vm-opts.patch ];
nativeBuildInputs = [
git
makeWrapper
nodejs
yarn
nodePackages.node-gyp
python3
prefetch-yarn-deps
];

postPatch = ''
substituteInPlace bin/nexus.vmoptions \
--replace ../sonatype-work /var/lib/sonatype-work \
--replace etc/karaf $out/etc/karaf \
--replace =. =$out
substituteInPlace components/nexus-rapture/package.json --replace "workspace:" ""
substituteInPlace plugins/nexus-coreui-plugin/package.json --replace "workspace:" ""
substituteInPlace pom.xml \
--replace "<goal>install-node-and-yarn</goal>" " "

mkdir -p components/nexus-ui-plugin/target/node/yarn/dist/bin/
mkdir -p components/nexus-rapture/target/node/yarn/dist/bin/
ln -s ${yarn}/bin/yarn components/nexus-ui-plugin/target/node/yarn/dist/bin/
ln -s ${yarn}/bin/yarn components/nexus-rapture/target/node/yarn/dist/bin/
'';

preBuild = ''
export HOME=$NIX_BUILD_TOP/fake_home
# use our yarn.lock instead of upstream
cp ${./yarn.lock} yarn.lock
${yarn}/bin/yarn config --offline set yarn-offline-mirror ${offline-cache}
fixup-yarn-lock ./yarn.lock

${yarn}/bin/yarn install --offline
patchShebangs node_modules/
'';

installPhase = ''
runHook preInstall

mkdir -p $out
cp -rfv * .install4j $out
cp -rfv assemblies/nexus-base-template/target/assembly/* $out
rm -fv $out/bin/nexus.bat


chmod +x $out/bin/nexus
wrapProgram $out/bin/nexus \
--set JAVA_HOME ${jre_headless} \
--set ALTERNATIVE_NAME "nexus" \
--prefix PATH "${lib.makeBinPath [ gawk ]}"
--set JAVA_HOME ${jre_headless} \
--set ALTERNATIVE_NAME "nexus" \
--set KARAF_BASE "$out" \
--set KARAF_DATA "/var/lib/nexus/" \
--set KARAF_ETC "$out/etc/karaf" \
--prefix PATH "${lib.makeBinPath [ gawk ]}"

runHook postInstall
'';

meta = with lib; {
description = "Repository manager for binary software components";
homepage = "https://www.sonatype.com/products/sonatype-nexus-oss";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
maintainers = with maintainers; [ aespinosa ironpinguin zaninime ];
maintainers = with maintainers; [ aespinosa ironpinguin s1341 zaninime ];
};
}
48 changes: 0 additions & 48 deletions pkgs/development/tools/repository-managers/nexus/nexus-bin.patch

This file was deleted.

This file was deleted.