Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 99 lines 2.6 kB view raw
1{ 2 elk7Version, 3 lib, 4 stdenv, 5 fetchurl, 6 makeWrapper, 7 jre_headless, 8 util-linux, 9 gnugrep, 10 coreutils, 11 autoPatchelfHook, 12 zlib, 13}: 14 15let 16 info = lib.splitString "-" stdenv.hostPlatform.system; 17 arch = lib.elemAt info 0; 18 plat = lib.elemAt info 1; 19 hashes = { 20 x86_64-linux = "sha512-xlbdx/fFQxilECdDiN80U+s+huBowo9Qf5tDIYwZ1z9gUCriNL0rMNDkvzUDL73BEI3WMFMqHdbi3cn7b5l9gA=="; 21 x86_64-darwin = "sha512-hiTSp7lO/x6tBYiUgKglce39k/oxT4hUlTAoC50pYFiqANALAN+2E0HtZdvsMmrOn4aGLxh+SKVglMHfrGxr+g=="; 22 aarch64-linux = "sha512-MPrDfBMcwNCgWW8dpOeAtlz9Odfk/0z8i+Rn08hTp35kU849KdPQLTmexlvnf/jVwqfwzN2xWJtNF0sQO26pUA=="; 23 aarch64-darwin = "sha512-uq5VVwvbOX4Rv32iLFw+RalFPBxQqA+1hBjFw3svzOaD1caOOrGHD4lJVHFxsFw0xl//AZuSG7S3r7Eh9AmWvQ=="; 24 }; 25in 26stdenv.mkDerivation rec { 27 pname = "elasticsearch"; 28 version = elk7Version; 29 30 src = fetchurl { 31 url = "https://artifacts.elastic.co/downloads/elasticsearch/${pname}-${version}-${plat}-${arch}.tar.gz"; 32 hash = hashes.${stdenv.hostPlatform.system} or (throw "Unknown architecture"); 33 }; 34 35 patches = [ ./es-home-6.x.patch ]; 36 37 postPatch = '' 38 substituteInPlace bin/elasticsearch-env --replace \ 39 "ES_CLASSPATH=\"\$ES_HOME/lib/*\"" \ 40 "ES_CLASSPATH=\"$out/lib/*\"" 41 42 substituteInPlace bin/elasticsearch-cli --replace \ 43 "ES_CLASSPATH=\"\$ES_CLASSPATH:\$ES_HOME/\$additional_classpath_directory/*\"" \ 44 "ES_CLASSPATH=\"\$ES_CLASSPATH:$out/\$additional_classpath_directory/*\"" 45 ''; 46 47 nativeBuildInputs = [ 48 makeWrapper 49 ] 50 ++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; 51 52 buildInputs = [ 53 jre_headless 54 util-linux 55 zlib 56 ]; 57 58 runtimeDependencies = [ zlib ]; 59 60 installPhase = '' 61 mkdir -p $out 62 cp -R bin config lib modules plugins $out 63 64 chmod +x $out/bin/* 65 66 substituteInPlace $out/bin/elasticsearch \ 67 --replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore" 68 69 wrapProgram $out/bin/elasticsearch \ 70 --prefix PATH : "${ 71 lib.makeBinPath [ 72 util-linux 73 coreutils 74 gnugrep 75 ] 76 }" \ 77 --set JAVA_HOME "${jre_headless}" 78 79 wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}" 80 ''; 81 82 passthru = { 83 enableUnfree = true; 84 }; 85 86 meta = with lib; { 87 description = "Open Source, Distributed, RESTful Search Engine"; 88 sourceProvenance = with sourceTypes; [ 89 binaryBytecode 90 binaryNativeCode 91 ]; 92 license = licenses.elastic20; 93 platforms = platforms.unix; 94 maintainers = with maintainers; [ 95 apeschar 96 basvandijk 97 ]; 98 }; 99}