File: amazon-corretto-17.nix

package info (click to toggle)
aws-crt-python 0.24.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 75,932 kB
  • sloc: ansic: 418,984; python: 23,626; makefile: 6,035; sh: 4,075; ruby: 208; java: 82; perl: 73; cpp: 25; xml: 11
file content (90 lines) | stat: -rw-r--r-- 2,513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
  pname = "amazon-corretto";
  version = "17";
  # From https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html
  src = let
    uri = "https://corretto.aws/downloads/resources";
    corretto-version = "17.0.7.7.1";
  in {
    x86_64-linux = pkgs.fetchzip {
      url =
        "${uri}/${corretto-version}/amazon-corretto-${corretto-version}-linux-x64.tar.gz";
      sha256 = "sha256-DEkfpGiqcas4HcAc327uMZj5BDR29JYSP0g4sEbFVSU=";
    };
    aarch64-linux = pkgs.fetchzip {
      url =
        "${uri}/${corretto-version}/amazon-corretto-${corretto-version}-linux-aarch64.tar.gz";
      sha256 = "sha256-DvL/1F1FD7bksodDNNJL+lKBMWOPuYdOihJ/CQxosNU=";
    };
    # TODO: The Mac versions will be validated in future darwin PR - nix still wants them defined.
    x86_64-darwin = pkgs.fetchzip {
      url =
        "${uri}/${corretto-version}/amazon-corretto-${corretto-version}-macosx-x64.tar.gz";
      sha256 = "sha256-DvL/1F1FD7bksodDNNJL+lKBMWOPuYdOihJ/CQxosNU=";
    };
    aarch64-darwin = pkgs.fetchzip {
      url =
        "${uri}/${corretto-version}/amazon-corretto-${corretto-version}-macosx-aarch64.tar.gz";
      sha256 = "sha256-DvL/1F1FD7bksodDNNJL+lKBMWOPuYdOihJ/CQxosNU=";
    };
  }.${pkgs.stdenv.hostPlatform.system} or (throw
    "No build profile setup for this platform: ${pkgs.stdenv.hostPlatform.system}");

  # See: https://github.com/NixOS/patchelf/issues/10
  dontStrip = 1;

  buildInputs = with pkgs; [
    autoPatchelfHook
    cpio
    cups
    file
    fontconfig
    freetype
    gdk-pixbuf
    giflib
    glib
    gtk2-x11
    harfbuzz
    lcms2
    libjpeg
    libpng
    perl
    which
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXinerama
    xorg.libXrandr
    xorg.libXrender
    xorg.libXt
    xorg.libXtst
    xorg.libXxf86vm
    zip
    zlib
  ];

  # Arm doesn't have this, and because Corretto was built elsewhere, we need
  # to change the interpreter: https://github.com/NixOS/patchelf
  autoPatchelfIgnoreMissingDeps = [ "libasound.so.2" ];

  buildPhase = ''
    echo "Corretto is already built"
  '';

  installPhase = ''
    mkdir -p $out/nix-support
    cp -av ./* $out/
    ln -s $out/Contents/Home/* $out/

    # Remove some broken manpages/demo.
    rm -rf $out/Home/man/ja*
    rm -rf $out/Home/demo

    # Set JAVA_HOME automatically.
    cat <<EOF >> $out/nix-support/setup-hook
    if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
    EOF
  '';
}