2022-12-28 21:21:41 +00:00
|
|
|
{ config
|
|
|
|
, elk7Version
|
2020-04-24 23:36:52 +00:00
|
|
|
, enableUnfree ? true
|
2021-09-18 10:52:07 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2021-04-05 15:23:46 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
, jre
|
|
|
|
}:
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
2023-02-02 18:25:31 +00:00
|
|
|
info = lib.splitString "-" stdenv.hostPlatform.system;
|
|
|
|
arch = lib.elemAt info 0;
|
|
|
|
plat = lib.elemAt info 1;
|
2023-10-09 19:29:22 +00:00
|
|
|
hashes =
|
2021-09-18 10:52:07 +00:00
|
|
|
if enableUnfree
|
|
|
|
then {
|
2024-01-25 14:12:00 +00:00
|
|
|
x86_64-linux = "sha512-ze0hJxUHCN52bOxUs5upDj64tIE58P2BTow2kaCo6HreRiF9rfTTzNkNr/hCmEgE+/oFbgSEuOQLz+6G373RDQ==";
|
|
|
|
x86_64-darwin = "sha512-FOFd8d+4UddSGorjuUWW/JbQ5fQH4LU1f1HJLmdbfnb8Q5L4GEveb2LmWNILU8/a85V4HGmD6lL8mCJqH9CULQ==";
|
|
|
|
aarch64-linux = "sha512-giYqW88/6iT3haXzJVn/+b7uxjYhHq4GERmiq3tMIvjxDyu7B6g+X7JneaTYxhpNdn6gOD/hfXgNv+hFRq6lgg==";
|
2021-09-18 10:52:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2024-01-25 14:12:00 +00:00
|
|
|
x86_64-linux = "sha512-OC9gx76k+RMdjqcDkrJCNbPYSQameyddaYMxUIB0foVxCmo6UvbdcwZGXRLPPn95in8rYOCjvPoBkmupiQw9xQ==";
|
|
|
|
x86_64-darwin = "sha512-1OEfEED/jjlT3Fd095Y5VYiWKnovytI3UYCCy1Rs3tEvkZPHYwqIQHfMQYeAvGgUci37ADwEDu8xrSQULHToLw==";
|
|
|
|
aarch64-linux = "sha512-QWW0AXOMNIXThxpUiRomvINm+917MvGrSDndrEw11IYYuvi0d0dckJiRytfnBbBNoOKpVhB68uOmfjIcZBNpWQ==";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
this = stdenv.mkDerivation rec {
|
|
|
|
version = elk7Version;
|
2023-02-02 18:25:31 +00:00
|
|
|
pname = "logstash${lib.optionalString (!enableUnfree) "-oss"}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://artifacts.elastic.co/downloads/logstash/${pname}-${version}-${plat}-${arch}.tar.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = hashes.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
dontBuild = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchShebangs = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
makeWrapper
|
2022-04-15 01:41:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
jre
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r {Gemfile*,modules,vendor,lib,bin,config,data,logstash-core,logstash-core-plugin-api} $out
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patchShebangs $out/bin/logstash
|
|
|
|
patchShebangs $out/bin/logstash-plugin
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
wrapProgram $out/bin/logstash \
|
|
|
|
--set JAVA_HOME "${jre}"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
wrapProgram $out/bin/logstash-plugin \
|
|
|
|
--set JAVA_HOME "${jre}"
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +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";
|
2022-07-14 12:49:19 +00:00
|
|
|
sourceProvenance = with sourceTypes; [
|
|
|
|
fromSource
|
|
|
|
binaryBytecode # source bundles dependencies as jars
|
|
|
|
binaryNativeCode # bundled jruby includes native code
|
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
license = if enableUnfree then licenses.elastic20 else licenses.asl20;
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.unix;
|
2023-11-16 04:20:00 +00:00
|
|
|
maintainers = with maintainers; [ offline basvandijk ];
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
passthru.tests =
|
2023-02-02 18:25:31 +00:00
|
|
|
lib.optionalAttrs (config.allowUnfree && enableUnfree) (
|
2022-12-28 21:21:41 +00:00
|
|
|
assert this.drvPath == nixosTests.elk.unfree.ELK-7.elkPackages.logstash.drvPath;
|
2021-09-18 10:52:07 +00:00
|
|
|
{
|
2022-12-28 21:21:41 +00:00
|
|
|
elk = nixosTests.elk.unfree.ELK-7;
|
2021-09-18 10:52:07 +00:00
|
|
|
}
|
|
|
|
);
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
in
|
|
|
|
this
|