depot/third_party/nixpkgs/pkgs/tools/misc/graylog/graylog.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03:00

41 lines
1.2 KiB
Nix

{ lib, stdenv, fetchurl, makeWrapper, openjdk11_headless, openjdk17_headless, systemd, nixosTests}:
{ version, sha256, maintainers, license }:
stdenv.mkDerivation rec {
pname = "graylog_${lib.versions.majorMinor version}";
inherit version;
src = fetchurl {
url = "https://packages.graylog2.org/releases/graylog/graylog-${version}.tgz";
inherit sha256;
};
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
makeWrapperArgs = [
"--set-default" "JAVA_HOME" "${if (lib.versionAtLeast version "5.0") then openjdk17_headless else openjdk11_headless}"
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ systemd ]}"
];
passthru.tests = { inherit (nixosTests) graylog; };
installPhase = ''
mkdir -p $out
cp -r {graylog.jar,bin,plugin} $out
'' + lib.optionalString (lib.versionOlder version "4.3") ''
cp -r lib $out
'' + ''
wrapProgram $out/bin/graylogctl $makeWrapperArgs
'';
meta = with lib; {
description = "Open source log management solution";
homepage = "https://www.graylog.org/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
inherit license;
inherit maintainers;
mainProgram = "graylogctl";
platforms = platforms.unix;
};
}