From 53ae6af491e6c1be31d2786d1908b87c1bb1267b Mon Sep 17 00:00:00 2001 From: Matthieu Daniel-Thomas Date: Thu, 7 Nov 2024 09:23:18 +0100 Subject: [PATCH] nixos/phoebus: add modules Add the possibility to enable phoebus in a nixos configuration Add the possibility to edit java_opts --- nixos/module-list.nix | 1 + nixos/modules/phoebus/client.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 nixos/modules/phoebus/client.nix diff --git a/nixos/module-list.nix b/nixos/module-list.nix index 399e1d06..5daef8a4 100644 --- a/nixos/module-list.nix +++ b/nixos/module-list.nix @@ -7,4 +7,5 @@ ./modules/phoebus/alarm-server.nix ./modules/phoebus/olog.nix ./modules/phoebus/save-and-restore.nix + ./modules/phoebus/client.nix ] diff --git a/nixos/modules/phoebus/client.nix b/nixos/modules/phoebus/client.nix new file mode 100644 index 00000000..de7b683c --- /dev/null +++ b/nixos/modules/phoebus/client.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + epnix, + pkgs, + ... +}: let + cfg = config.programs.phoebus-client; + pkg = pkgs.epnix.phoebus.override {java_opts = cfg.java_opts;}; +in { + options.programs.phoebus-client = { + enable = lib.mkEnableOption ''Enable the Phoebus client''; + java_opts = lib.mkOption { + type = lib.types.str; + default = "-XX:MinHeapSize=128m -XX:MaxHeapSize=4g -XX:InitialHeapSize=1g -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:-ShrinkHeapInSteps -XX:NativeMemoryTracking=detail"; + example = "-XX:MinHeapSize=128m -XX:MaxHeapSize=4g -XX:InitialHeapSize=1g"; + description = '' + This wrapper for the `phoebus-unwrapped` executable sets the `JAVA_OPTS` + environment variable with the provided `java_opts` value. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [pkg]; + }; +}