nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 jdk11_headless,
6 makeWrapper,
7 nixosTests,
8 bash,
9 coreutils,
10}:
11let
12 # Latest supported LTS JDK for Zookeeper 3.9:
13 # https://zookeeper.apache.org/doc/r3.9.4/zookeeperAdmin.html#sc_requiredSoftware
14 jre = jdk11_headless;
15in
16stdenv.mkDerivation (finalAttrs: {
17 pname = "zookeeper";
18 version = "3.9.4";
19
20 src = fetchurl {
21 url = "mirror://apache/zookeeper/zookeeper-${finalAttrs.version}/apache-zookeeper-${finalAttrs.version}-bin.tar.gz";
22 hash = "sha512-Nr/65kQO0Nce2DpiG4xSxYOGC0FIEhlzcyN/DBSL0W5rWZl3yQ5euBwPzmuC70SqeCYhU1QXz/xMKgpRpW8s3w==";
23 };
24
25 nativeBuildInputs = [ makeWrapper ];
26 buildInputs = [ jre ];
27
28 installPhase = ''
29 runHook preInstall
30 mkdir -p $out
31 cp -R conf docs lib $out
32 mkdir -p $out/bin
33 cp -R bin/{zkCli,zkCleanup,zkEnv,zkServer,zkSnapShotToolkit,zkTxnLogToolkit}.sh $out/bin
34 patchShebangs $out/bin
35 substituteInPlace $out/bin/zkServer.sh \
36 --replace-fail /bin/echo ${coreutils}/bin/echo
37 for i in $out/bin/{zkCli,zkCleanup,zkServer,zkSnapShotToolkit,zkTxnLogToolkit}.sh; do
38 wrapProgram $i \
39 --set JAVA_HOME "${jre}" \
40 --prefix PATH : "${bash}/bin"
41 done
42 chmod -x $out/bin/zkEnv.sh
43 runHook postInstall
44 '';
45
46 passthru = {
47 tests = {
48 nixos = nixosTests.zookeeper;
49 };
50 inherit jre;
51 };
52
53 meta = {
54 homepage = "https://zookeeper.apache.org";
55 description = "Apache Zookeeper";
56 changelog = "https://zookeeper.apache.org/doc/r${finalAttrs.version}/releasenotes.html";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maintainers; [
59 nathan-gs
60 ztzg
61 ];
62 platforms = lib.platforms.unix;
63 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
64 };
65})