@@ -1,23 +1,38 @@
1−{ lib, stdenv, fetchurl, makeWrapper, autoPatchelfHook
2−, jdk8_headless, jdk11_headless
3−, bash, coreutils, which
4−, bzip2, cyrus_sasl , protobuf3_7, snappy, zlib, zstd
1+{ lib
2+, stdenv
3+, fetchurl
4+, makeWrapper
5+, autoPatchelfHook
6+, jdk8_headless
7+, jdk11_headless
8+, bash
9+, coreutils
10+, which
11+, bzip2
12+, cyrus_sasl
13+, protobuf3_7
14+, snappy
15+, zlib
16+, zstd
517, openssl
618}:
719
820with lib;
921
22+assert elem stdenv.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
23+
1024let
11− common = { pname, version, untarDir ? "${pname}-${version}", sha256, jdk, openssl, nativeLibs ? [ ], libPatches ? "" }:
25+ common = { pname, version, untarDir ? "${pname}-${version}", sha256, jdk, openssl ? null, nativeLibs ? [ ], libPatches ? "" }:
1226 stdenv.mkDerivation rec {
1327 inherit pname version jdk libPatches untarDir openssl;
1428 src = fetchurl {
15− url = "mirror://apache/hadoop/common/hadoop-${version}/hadoop-${version}.tar.gz";
16− inherit sha256;
29+ url = "mirror://apache/hadoop/common/hadoop-${version}/hadoop-${version}" + optionalString stdenv.isAarch64 "-aarch64" + ".tar.gz";
30+ sha256 = sha256.${stdenv.system};
1731 };
32+ doCheck = true;
1833
1934 nativeBuildInputs = [ makeWrapper ]
20− ++ optional (nativeLibs != [] || libPatches != "") [ autoPatchelfHook ];
35+ ++ optional (stdenv.isLinux && (nativeLibs != [ ] || libPatches != "")) [ autoPatchelfHook ];
2136 buildInputs = [ openssl ] ++ nativeLibs;
2237
2338 installPhase = ''
@@ -51,46 +66,49 @@ let
5166 computers, each of which may be prone to failures.
5267 '';
5368 maintainers = with maintainers; [ volth illustris ];
54− platforms = [ "x86_64-linux" ];
69+ platforms = attrNames sha256;
5570 };
56−
5771 };
5872in
5973{
6074 # Different version of hadoop support different java runtime versions
6175 # https://cwiki.apache.org/confluence/display/HADOOP/Hadoop+Java+Versions
62− hadoop_3_3 = common rec {
63− pname = "hadoop";
64− version = "3.3.1";
65− sha256 = "1b3v16ihysqaxw8za1r5jlnphy8dwhivdx2d0z64309w57ihlxxd";
66− untarDir = "${pname}-${version}";
67− jdk = jdk11_headless;
68− inherit openssl;
69− # TODO: Package and add Intel Storage Acceleration Library
70− nativeLibs = [ stdenv.cc.cc.lib protobuf3_7 zlib snappy ];
71− libPatches = ''
72− ln -s ${getLib cyrus_sasl}/lib/libsasl2.so $out/lib/${untarDir}/lib/native/libsasl2.so.2
73− ln -s ${getLib openssl}/lib/libcrypto.so $out/lib/${untarDir}/lib/native/
74− ln -s ${getLib zlib}/lib/libz.so.1 $out/lib/${untarDir}/lib/native/
75− ln -s ${getLib zstd}/lib/libzstd.so.1 $out/lib/${untarDir}/lib/native/
76− ln -s ${getLib bzip2}/lib/libbz2.so.1 $out/lib/${untarDir}/lib/native/
77− patchelf --add-rpath ${jdk.home}/lib/server $out/lib/${untarDir}/lib/native/libnativetask.so.1.0.0
78− '';
79− };
76+ hadoop_3_3 =
77+ common
78+ (rec {
79+ pname = "hadoop";
80+ version = "3.3.1";
81+ untarDir = "${pname}-${version}";
82+ sha256 = rec {
83+ x86_64-linux = "1b3v16ihysqaxw8za1r5jlnphy8dwhivdx2d0z64309w57ihlxxd";
84+ x86_64-darwin = x86_64-linux;
85+ aarch64-linux = "00ln18vpi07jq2slk3kplyhcj8ad41n0yl880q5cihilk7daclxz";
86+ aarch64-darwin = aarch64-linux;
87+ };
88+
89+ inherit openssl;
90+ nativeLibs = [ stdenv.cc.cc.lib protobuf3_7 zlib snappy ];
91+ libPatches = ''
92+ ln -s ${getLib cyrus_sasl}/lib/libsasl2.so $out/lib/${untarDir}/lib/native/libsasl2.so.2
93+ ln -s ${getLib openssl}/lib/libcrypto.so $out/lib/${untarDir}/lib/native/
94+ ln -s ${getLib zlib}/lib/libz.so.1 $out/lib/${untarDir}/lib/native/
95+ ln -s ${getLib zstd}/lib/libzstd.so.1 $out/lib/${untarDir}/lib/native/
96+ ln -s ${getLib bzip2}/lib/libbz2.so.1 $out/lib/${untarDir}/lib/native/
97+ '' + optionalString stdenv.isLinux "patchelf --add-rpath ${jdk.home}/lib/server $out/lib/${untarDir}/lib/native/libnativetask.so.1.0.0";
98+ jdk = jdk11_headless;
99+ });
80100 hadoop_3_2 = common rec {
81101 pname = "hadoop";
82102 version = "3.2.2";
83− sha256 = "1hxq297cqvkfgz2yfdiwa3l28g44i2abv5921k2d6b4pqd33prwp";
103+ sha256.x86_64-linux = "1hxq297cqvkfgz2yfdiwa3l28g44i2abv5921k2d6b4pqd33prwp";
84104 jdk = jdk8_headless;
85105 # not using native libs because of broken openssl_1_0_2 dependency
86106 # can be manually overriden
87− openssl = null;
88107 };
89108 hadoop2 = common rec {
90109 pname = "hadoop";
91110 version = "2.10.1";
92− sha256 = "1w31x4bk9f2swnx8qxx0cgwfg8vbpm6cy5lvfnbbpl3rsjhmyg97";
111+ sha256.x86_64-linux = "1w31x4bk9f2swnx8qxx0cgwfg8vbpm6cy5lvfnbbpl3rsjhmyg97";
93112 jdk = jdk8_headless;
94− openssl = null;
95113 };
96114}