From 07828dc05bcc0d49c1516978a6f4bfb93b4138ce Mon Sep 17 00:00:00 2001 From: Lucas Bergman <lucas@bergmans.us> Date: Thu, 9 Nov 2023 19:47:39 +0000 Subject: [PATCH] nixos/unifi: Add extraJvmOptions option This can be useful for adding extra logging, tweaking garbage collector parameters, and for using JMX to monitor the JVM. --- nixos/modules/services/networking/unifi.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix index b2d41402173c..537a4db95ca7 100644 --- a/nixos/modules/services/networking/unifi.nix +++ b/nixos/modules/services/networking/unifi.nix @@ -12,6 +12,7 @@ let ] ++ (lib.optional (cfg.initialJavaHeapSize != null) "-Xms${(toString cfg.initialJavaHeapSize)}m") ++ (lib.optional (cfg.maximumJavaHeapSize != null) "-Xmx${(toString cfg.maximumJavaHeapSize)}m") + ++ cfg.extraJvmOptions ++ [ "-jar" "${stateDir}/lib/ace.jar" ]); in { @@ -85,6 +86,15 @@ in ''; }; + services.unifi.extraJvmOptions = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + example = lib.literalExpression ''["-Xlog:gc"]''; + description = lib.mdDoc '' + Set extra options to pass to the JVM. + ''; + }; + }; config = lib.mkIf cfg.enable {