From 640961beb819989b5d8293c8f162947bccf5e1cb Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 22 Sep 2020 08:28:28 +0200 Subject: [PATCH 1/5] apacheKafka: Version-configurable JREs for package --- pkgs/servers/apache-kafka/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index 4bd50653d52c..e3ea6b6297ff 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -1,21 +1,23 @@ -{ lib, stdenv, fetchurl, jre8, makeWrapper, bash, coreutils, gnugrep, gnused, ps, +{ lib, stdenv, fetchurl, jdk8_headless, jdk11_headless, makeWrapper, bash, coreutils, gnugrep, gnused, ps, majorVersion ? "1.0" }: let + jre8 = jdk8_headless; + jre11 = jdk11_headless; versionMap = { "2.4" = { kafkaVersion = "2.4.1"; scalaVersion = "2.12"; sha256 = "0ahsprmpjz026mhbr79187wfdrxcg352iipyfqfrx68q878wnxr1"; + jre = jre8; }; "2.5" = { kafkaVersion = "2.5.0"; scalaVersion = "2.13"; sha256 = "0w3g7ii8x63m2blv2a8c491d0diczpliaqm9f7w5yn98hikh0aqi"; + jre = jre8; }; }; - - jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 in with versionMap.${majorVersion}; @@ -63,5 +65,5 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.ragge ]; platforms = platforms.unix; }; - + passthru = { inherit jre; }; } From 08ef8270563ee69bde17e69be803d89d353cd905 Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 22 Sep 2020 08:29:43 +0200 Subject: [PATCH 2/5] nixos/apache-kafka: Drop default jvmOptions --- nixos/modules/services/misc/apache-kafka.nix | 14 +------------- nixos/tests/kafka.nix | 5 ----- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/nixos/modules/services/misc/apache-kafka.nix b/nixos/modules/services/misc/apache-kafka.nix index f3a650a260f1..c1644c8f3658 100644 --- a/nixos/modules/services/misc/apache-kafka.nix +++ b/nixos/modules/services/misc/apache-kafka.nix @@ -90,19 +90,7 @@ in { jvmOptions = mkOption { description = "Extra command line options for the JVM running Kafka."; - default = [ - "-server" - "-Xmx1G" - "-Xms1G" - "-XX:+UseCompressedOops" - "-XX:+UseParNewGC" - "-XX:+UseConcMarkSweepGC" - "-XX:+CMSClassUnloadingEnabled" - "-XX:+CMSScavengeBeforeRemark" - "-XX:+DisableExplicitGC" - "-Djava.awt.headless=true" - "-Djava.net.preferIPv4Stack=true" - ]; + default = []; type = types.listOf types.str; example = [ "-Djava.net.preferIPv4Stack=true" diff --git a/nixos/tests/kafka.nix b/nixos/tests/kafka.nix index d5c54f7d9910..2969f3336de7 100644 --- a/nixos/tests/kafka.nix +++ b/nixos/tests/kafka.nix @@ -30,11 +30,6 @@ let ''; package = kafkaPackage; zookeeper = "zookeeper1:2181"; - # These are the default options, but UseCompressedOops doesn't work with 32bit JVM - jvmOptions = [ - "-server" "-Xmx1G" "-Xms1G" "-XX:+UseParNewGC" "-XX:+UseConcMarkSweepGC" "-XX:+CMSClassUnloadingEnabled" - "-XX:+CMSScavengeBeforeRemark" "-XX:+DisableExplicitGC" "-Djava.awt.headless=true" "-Djava.net.preferIPv4Stack=true" - ] ++ optionals (! pkgs.stdenv.isi686 ) [ "-XX:+UseCompressedOops" ]; }; networking.firewall.allowedTCPPorts = [ 9092 ]; From fd02940262ab3b263bc979f6e28c6ed74ed9b41c Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 22 Sep 2020 08:30:29 +0200 Subject: [PATCH 3/5] nixos/apache-kafka: Use version-matched jre --- nixos/doc/manual/release-notes/rl-2105.xml | 15 +++++++++++++++ nixos/modules/services/misc/apache-kafka.nix | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index 9a1e6b6618df..e052632ecafd 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -562,6 +562,21 @@ self: super: no longer uses the deprecated cirrus and vesa device dependent X drivers by default. It also enables both amdgpu and nouveau drivers by default now. + + + The apacheKafka packages are now built with + version-matched JREs. Versions 2.6 and above, the ones that recommend it, + use jdk11, while versions below remain on jdk8. The NixOS service has + been adjusted to start the service using the same version as the package, + adjustable with the new + services.apache-kafka.jre + option. Furthermore, the default list of + services.apache-kafka.jvmOptions + have been removed. You should set your own according to the + upstream documentation + for your Kafka version. + + diff --git a/nixos/modules/services/misc/apache-kafka.nix b/nixos/modules/services/misc/apache-kafka.nix index c1644c8f3658..69dfadfe54e0 100644 --- a/nixos/modules/services/misc/apache-kafka.nix +++ b/nixos/modules/services/misc/apache-kafka.nix @@ -106,6 +106,13 @@ in { type = types.package; }; + jre = mkOption { + description = "The JRE with which to run Kafka"; + default = cfg.package.passthru.jre; + defaultText = "pkgs.apacheKafka.passthru.jre"; + type = types.package; + }; + }; config = mkIf cfg.enable { @@ -126,7 +133,7 @@ in { after = [ "network.target" ]; serviceConfig = { ExecStart = '' - ${pkgs.jre}/bin/java \ + ${cfg.jre}/bin/java \ -cp "${cfg.package}/libs/*" \ -Dlog4j.configuration=file:${logConfig} \ ${toString cfg.jvmOptions} \ From f2edda94c5bd25f8981ce00e85ee3f7ae4a79d1d Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 22 Sep 2020 08:43:34 +0200 Subject: [PATCH 4/5] apacheKafka: 2.5.0 -> 2.5.1 and adjust scala Only 2.6.X recommends Scala 2.13, so use 2.12 --- pkgs/servers/apache-kafka/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index e3ea6b6297ff..7ae0810f592f 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -12,9 +12,9 @@ let jre = jre8; }; "2.5" = { - kafkaVersion = "2.5.0"; - scalaVersion = "2.13"; - sha256 = "0w3g7ii8x63m2blv2a8c491d0diczpliaqm9f7w5yn98hikh0aqi"; + kafkaVersion = "2.5.1"; + scalaVersion = "2.12"; + sha256 = "1wn4iszrm2rvsfyyr515zx79k5m86davjkcwcwpxcgc4k3q0z7lv"; jre = jre8; }; }; From fa4bb6566af1d74da42fdb4d6c3c741a28dd23f0 Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 22 Sep 2020 08:45:06 +0200 Subject: [PATCH 5/5] apacheKafka: init 2.6.1, make default --- nixos/tests/kafka.nix | 1 + pkgs/servers/apache-kafka/default.nix | 6 ++++++ pkgs/top-level/all-packages.nix | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/tests/kafka.nix b/nixos/tests/kafka.nix index 2969f3336de7..034601c815b9 100644 --- a/nixos/tests/kafka.nix +++ b/nixos/tests/kafka.nix @@ -77,4 +77,5 @@ let in with pkgs; { kafka_2_4 = makeKafkaTest "kafka_2_4" apacheKafka_2_4; kafka_2_5 = makeKafkaTest "kafka_2_5" apacheKafka_2_5; + kafka_2_6 = makeKafkaTest "kafka_2_6" apacheKafka_2_6; } diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index 7ae0810f592f..935db27044f3 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -17,6 +17,12 @@ let sha256 = "1wn4iszrm2rvsfyyr515zx79k5m86davjkcwcwpxcgc4k3q0z7lv"; jre = jre8; }; + "2.6" = { + kafkaVersion = "2.6.1"; + scalaVersion = "2.13"; + sha256 = "1a2kd4r6f8z7qf886nnq9f350sblzzdi230j2hll7x156888573y"; + jre = jre11; + }; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4fd4f37b55cc..2245832ad6fc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11859,9 +11859,10 @@ in apacheAnt_1_9 = callPackage ../development/tools/build-managers/apache-ant/1.9.nix { }; ant = apacheAnt; - apacheKafka = apacheKafka_2_5; + apacheKafka = apacheKafka_2_6; apacheKafka_2_4 = callPackage ../servers/apache-kafka { majorVersion = "2.4"; }; apacheKafka_2_5 = callPackage ../servers/apache-kafka { majorVersion = "2.5"; }; + apacheKafka_2_6 = callPackage ../servers/apache-kafka { majorVersion = "2.6"; }; kt = callPackage ../tools/misc/kt {};