summary refs log tree commit diff
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2021-03-27 17:51:43 +0100
committerLinus Heckemann <git@sphalerite.org>2021-03-28 14:37:28 +0200
commit22de3c19e765088f8dfd243e9bbd95330d7d8a10 (patch)
tree53255230cb7e5ba357e9bb14813026b1912ce931
parentd3f7e969b9860fb80750147aeb56dab1c730e756 (diff)
downloadnixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar.gz
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar.bz2
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar.lz
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar.xz
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.tar.zst
nixpkgs-22de3c19e765088f8dfd243e9bbd95330d7d8a10.zip
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.
-rw-r--r--nixos/modules/services/logging/graylog.nix6
-rw-r--r--pkgs/tools/misc/graylog/default.nix4
2 files changed, 4 insertions, 6 deletions
diff --git a/nixos/modules/services/logging/graylog.nix b/nixos/modules/services/logging/graylog.nix
index a889a44d4b2..af70d27fcf9 100644
--- a/nixos/modules/services/logging/graylog.nix
+++ b/nixos/modules/services/logging/graylog.nix
@@ -39,7 +39,6 @@ in
         type = types.package;
         default = pkgs.graylog;
         defaultText = "pkgs.graylog";
-        example = literalExample "pkgs.graylog";
         description = "Graylog package to use.";
       };
 
@@ -138,14 +137,13 @@ in
       "d '${cfg.messageJournalDir}' - ${cfg.user} - - -"
     ];
 
-    systemd.services.graylog = with pkgs; {
+    systemd.services.graylog = {
       description = "Graylog Server";
       wantedBy = [ "multi-user.target" ];
       environment = {
-        JAVA_HOME = jre;
         GRAYLOG_CONF = "${confFile}";
       };
-      path = [ pkgs.jre_headless pkgs.which pkgs.procps ];
+      path = [ pkgs.which pkgs.procps ];
       preStart = ''
         rm -rf /var/lib/graylog/plugins || true
         mkdir -p /var/lib/graylog/plugins -m 755
diff --git a/pkgs/tools/misc/graylog/default.nix b/pkgs/tools/misc/graylog/default.nix
index 8ebb2924b03..b41cc9cb069 100644
--- a/pkgs/tools/misc/graylog/default.nix
+++ b/pkgs/tools/misc/graylog/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, makeWrapper, jre_headless, nixosTests }:
+{ lib, stdenv, fetchurl, makeWrapper, openjdk11_headless, nixosTests }:
 
 stdenv.mkDerivation rec {
   pname = "graylog";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   dontStrip = true;
 
   nativeBuildInputs = [ makeWrapper ];
-  makeWrapperArgs = [ "--prefix" "PATH" ":" "${jre_headless}/bin" ];
+  makeWrapperArgs = [ "--set-default" "JAVA_HOME" "${openjdk11_headless}" ];
 
   passthru.tests = { inherit (nixosTests) graylog; };