nixpkgs/pkgs/tools/misc/logstash/7.x.nix

82 lines
2.3 KiB
Nix
Raw Normal View History

{ elk7Version
2018-08-03 10:23:56 +00:00
, enableUnfree ? true
2021-08-30 03:25:15 +00:00
, lib
, stdenv
2018-08-03 10:23:56 +00:00
, fetchurl
, makeWrapper
2021-03-22 13:53:05 +00:00
, nixosTests
2018-08-03 10:23:56 +00:00
, jre
}:
2021-01-15 09:19:50 +00:00
with lib;
let
info = splitString "-" stdenv.hostPlatform.system;
arch = elemAt info 0;
plat = elemAt info 1;
shas =
if enableUnfree
then {
2021-02-26 10:31:39 +00:00
x86_64-linux = "0yjaki7gjffrz86hvqgn1gzhd9dc9llcj50g2x1sgpyn88zk0z0p";
x86_64-darwin = "0dqm66c89w1nvmbwqzphlqmf7avrycgv1nwd5b0k1z168fj0c3zm";
aarch64-linux = "11hjhyb48mjagmvqyxb780n57kr619h6p4adl2vs1zm97g9gslx8";
}
else {
2021-02-26 10:31:39 +00:00
x86_64-linux = "14b1649avjcalcsi0ffkgznq6d93qdk6m3j0i73mwfqka5d3dvy3";
x86_64-darwin = "0ypgdfklr5rxvsnc3czh231pa1z2h70366j1c6q5g64b3xnxpphs";
aarch64-linux = "01ainayr8fwwfix7dmxfhhmb23ji65dn4lbjwnj2w0pl0ym9h9w2";
};
2021-08-31 08:45:44 +00:00
this = stdenv.mkDerivation rec {
version = elk7Version;
pname = "logstash${optionalString (!enableUnfree) "-oss"}";
2021-02-26 10:31:39 +00:00
2021-08-31 08:45:44 +00:00
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/logstash/${pname}-${version}-${plat}-${arch}.tar.gz";
sha256 = shas.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
};
2021-08-31 08:45:44 +00:00
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
dontPatchShebangs = true;
2021-08-31 08:45:44 +00:00
buildInputs = [
makeWrapper
jre
];
2016-10-01 21:11:30 +00:00
2021-08-31 08:45:44 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r {Gemfile*,modules,vendor,lib,bin,config,data,logstash-core,logstash-core-plugin-api} $out
2016-10-01 21:11:30 +00:00
2021-08-31 08:45:44 +00:00
patchShebangs $out/bin/logstash
patchShebangs $out/bin/logstash-plugin
2016-10-01 21:11:30 +00:00
2021-08-31 08:45:44 +00:00
wrapProgram $out/bin/logstash \
--set JAVA_HOME "${jre}"
2021-08-31 08:45:44 +00:00
wrapProgram $out/bin/logstash-plugin \
--set JAVA_HOME "${jre}"
runHook postInstall
'';
2014-07-11 16:50:02 +00:00
2021-08-31 08:45:44 +00:00
meta = with lib; {
description = "Logstash is a data pipeline that helps you process logs and other event data from a variety of systems";
homepage = "https://www.elastic.co/products/logstash";
license = if enableUnfree then licenses.elastic else licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ wjlroe offline basvandijk ];
};
passthru.tests =
optionalAttrs (!enableUnfree) (
assert this.drvPath == nixosTests.elk.ELK-7.elkPackages.logstash.drvPath;
{
elk = nixosTests.elk.ELK-7;
}
);
2014-07-11 16:50:02 +00:00
};
2021-08-31 08:45:44 +00:00
in
this