Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

graylog: improve JRE handling

Since the upstream graylogctl script will prefer finding its java
executable based on JAVA_HOME, we now set this instead of PATH in
order to allow it to find the JRE. By setting it conditionally on it
not already being set, we allow selecting a different JRE at runtime.

We also explicitly use openjdk11, which supports the
UseConcMarkSweepGC option which graylog insists on using.

+4 -6
+2 -4
nixos/modules/services/logging/graylog.nix
··· 39 39 type = types.package; 40 40 default = pkgs.graylog; 41 41 defaultText = "pkgs.graylog"; 42 - example = literalExample "pkgs.graylog"; 43 42 description = "Graylog package to use."; 44 43 }; 45 44 ··· 138 137 "d '${cfg.messageJournalDir}' - ${cfg.user} - - -" 139 138 ]; 140 139 141 - systemd.services.graylog = with pkgs; { 140 + systemd.services.graylog = { 142 141 description = "Graylog Server"; 143 142 wantedBy = [ "multi-user.target" ]; 144 143 environment = { 145 - JAVA_HOME = jre; 146 144 GRAYLOG_CONF = "${confFile}"; 147 145 }; 148 - path = [ pkgs.jre_headless pkgs.which pkgs.procps ]; 146 + path = [ pkgs.which pkgs.procps ]; 149 147 preStart = '' 150 148 rm -rf /var/lib/graylog/plugins || true 151 149 mkdir -p /var/lib/graylog/plugins -m 755
+2 -2
pkgs/tools/misc/graylog/default.nix
··· 1 - { lib, stdenv, fetchurl, makeWrapper, jre_headless, nixosTests }: 1 + { lib, stdenv, fetchurl, makeWrapper, openjdk11_headless, nixosTests }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "graylog"; ··· 13 13 dontStrip = true; 14 14 15 15 nativeBuildInputs = [ makeWrapper ]; 16 - makeWrapperArgs = [ "--prefix" "PATH" ":" "${jre_headless}/bin" ]; 16 + makeWrapperArgs = [ "--set-default" "JAVA_HOME" "${openjdk11_headless}" ]; 17 17 18 18 passthru.tests = { inherit (nixosTests) graylog; }; 19 19