nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 fetchzip,
4 lib,
5 makeWrapper,
6 jre,
7 stripJavaArchivesHook,
8 versionCheckHook,
9}:
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "jib-cli";
13 version = "0.13.0";
14
15 src = fetchzip {
16 url = "https://github.com/GoogleContainerTools/jib/releases/download/v${finalAttrs.version}-cli/jib-jre-${finalAttrs.version}.zip";
17 hash = "sha256-3/wKpwVHVBU86GJfR4YGM5ba8pOOfLL+fKU7zwwU+Qc=";
18 };
19
20 nativeBuildInputs = [
21 makeWrapper
22 stripJavaArchivesHook
23 ];
24
25 nativeInstallCheckInputs = [ versionCheckHook ];
26 buildInputs = [ jre ];
27
28 dontBuild = true;
29 doInstallCheck = true;
30
31 versionCheckProgram = "${placeholder "out"}/bin/jib";
32
33 installPhase = ''
34 runHook preInstall
35 mkdir -p $out
36 cp -r lib $out/
37 jarPaths=$(find $out/lib -name '*.jar' | tr '\n' ':' | sed 's/:$//')
38 makeWrapper ${jre}/bin/java $out/bin/jib \
39 --add-flags "-cp \"$jarPaths\" com.google.cloud.tools.jib.cli.JibCli"
40 runHook postInstall
41 '';
42
43 meta = {
44 description = "Container image builder for Java using Jib CLI";
45 homepage = "https://github.com/GoogleContainerTools/jib";
46 license = lib.licenses.asl20;
47 maintainers = with lib.maintainers; [
48 sxmair
49 ];
50 mainProgram = "jib";
51 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
52 };
53})