From 4baea986a8b6698f555aeffb0334821aaf412ef7 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sat, 26 Oct 2024 12:10:08 +0200 Subject: [PATCH 1/4] add tideways service --- src/modules/languages/php.nix | 3 +- src/modules/services/tideways.nix | 87 +++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 src/modules/services/tideways.nix diff --git a/src/modules/languages/php.nix b/src/modules/languages/php.nix index 9b7bbcadb..57a4dc202 100644 --- a/src/modules/languages/php.nix +++ b/src/modules/languages/php.nix @@ -317,7 +317,8 @@ in languages.php.extensions = lib.optionals config.services.rabbitmq.enable [ "amqp" ] ++ lib.optionals config.services.redis.enable [ "redis" ] - ++ lib.optionals config.services.blackfire.enable [ "blackfire" ]; + ++ lib.optionals config.services.blackfire.enable [ "blackfire" ] + ++ lib.optionals config.services.tideways.enable [ "tideways" ]; languages.php.ini = '' ${lib.optionalString config.services.mysql.enable '' diff --git a/src/modules/services/tideways.nix b/src/modules/services/tideways.nix new file mode 100644 index 000000000..09998f743 --- /dev/null +++ b/src/modules/services/tideways.nix @@ -0,0 +1,87 @@ +{ pkgs, lib, config, ... }: + +let + cfg = config.services.tideways; + + socket = "${config.env.DEVENV_STATE}/tideways/tidewaysd.sock"; + + startScript = pkgs.writeShellScriptBin "start-tideways" '' + set -euo pipefail + + if [[ ! -d "${config.env.DEVENV_STATE}/tideways" ]]; then + mkdir -p "${config.env.DEVENV_STATE}/tideways" + fi + + exec ${cfg.daemonPackage}/bin/tideways-daemon -address ${socket} --env ${cfg.environment} + ''; +in +{ + options.services.tideways = { + enable = lib.mkEnableOption '' + Tideways profiler daemon + + It automatically installs Tideways PHP extension. + ''; + + apiKey = lib.mkOption { + type = lib.types.str; + description = '' + Sets the API-Key for the Tideways Daemon. + ''; + default = ""; + }; + + service = lib.mkOption { + type = lib.types.str; + description = '' + Sets the Service name for Tideways Daemon. + ''; + default = ""; + }; + + environment = lib.mkOption { + type = lib.types.str; + description = '' + Sets the Environment for Tideways Daemon. + ''; + default = "devenv"; + }; + + profilingSpace = lib.mkOption { + type = lib.types.bool; + description = '' + When the profiling space is enabled, the default monitoring will be disabled. + ''; + default = true; + }; + + daemonPackage = lib.mkOption { + type = lib.types.package; + description = "Which package of tideways-daemon to use"; + default = pkgs.tideways-daemon; + defaultText = lib.literalExpression "pkgs.tideways-daemon"; + }; + + cliPackage = lib.mkOption { + type = lib.types.package; + description = "Which package of tideways-cli to use"; + default = pkgs.tideways-cli; + defaultText = lib.literalExpression "pkgs.tideways-cli"; + }; + }; + + config = lib.mkIf cfg.enable { + packages = [ + cfg.cliPackage + ]; + + processes.tideways-daemon.exec = "${startScript}/bin/start-tideways"; + + languages.php.ini = '' + tideways.api_key=${cfg.apiKey} + tideways.service=${cfg.service} + tideways.connection=unix://${socket} + ${lib.optionalString cfg.profilingSpace "tideways.monitor=none"} + ''; + }; +} From 98d3dd7bf2adaf12772f12e54abc60ba5e3fb789 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Oct 2024 10:13:38 +0000 Subject: [PATCH 2/4] Auto generate docs/reference/options.md --- docs/reference/options.md | 155 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) diff --git a/docs/reference/options.md b/docs/reference/options.md index 588e9e99a..a06926889 100644 --- a/docs/reference/options.md +++ b/docs/reference/options.md @@ -40295,6 +40295,161 @@ Port for the Web UI. +## services.tideways.enable + + + +Whether to enable Tideways profiler daemon + +It automatically installs Tideways PHP extension. +. + + + +*Type:* +boolean + + + +*Default:* +` false ` + + + +*Example:* +` true ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.apiKey + + + +Sets the API-Key for the Tideways Daemon. + + + +*Type:* +string + + + +*Default:* +` "" ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.cliPackage + + + +Which package of tideways-cli to use + + + +*Type:* +package + + + +*Default:* +` pkgs.tideways-cli ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.daemonPackage + + + +Which package of tideways-daemon to use + + + +*Type:* +package + + + +*Default:* +` pkgs.tideways-daemon ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.environment + + + +Sets the Environment for Tideways Daemon. + + + +*Type:* +string + + + +*Default:* +` "devenv" ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.profilingSpace + + + +When the profiling space is enabled, the default monitoring will be disabled. + + + +*Type:* +boolean + + + +*Default:* +` true ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + +## services.tideways.service + + + +Sets the Service name for Tideways Daemon. + + + +*Type:* +string + + + +*Default:* +` "" ` + +*Declared by:* + - [https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/tideways.nix) + + + ## services.trafficserver.enable From 067f09b0e1ef033c31afa6216683e27ec975a604 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Oct 2024 10:13:41 +0000 Subject: [PATCH 3/4] Auto generate missing individual markdowns --- docs/individual-docs/services/tideways.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/individual-docs/services/tideways.md diff --git a/docs/individual-docs/services/tideways.md b/docs/individual-docs/services/tideways.md new file mode 100644 index 000000000..d3615c80f --- /dev/null +++ b/docs/individual-docs/services/tideways.md @@ -0,0 +1,5 @@ + + +[comment]: # (Please add your documentation on top of this line) + +@AUTOGEN_OPTIONS@ From 3f6420b7cf2a4c4e31d90e29269fe056504abb1e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Oct 2024 10:14:41 +0000 Subject: [PATCH 4/4] Auto generate docs and examples --- docs/services-all.md | 1 + docs/supported-services/tideways.md | 134 ++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 docs/supported-services/tideways.md diff --git a/docs/services-all.md b/docs/services-all.md index 171344687..c94be566c 100644 --- a/docs/services-all.md +++ b/docs/services-all.md @@ -26,6 +26,7 @@ services.redis.enable = true; services.sqld.enable = true; services.temporal.enable = true; + services.tideways.enable = true; services.trafficserver.enable = true; services.typesense.enable = true; services.varnish.enable = true; diff --git a/docs/supported-services/tideways.md b/docs/supported-services/tideways.md new file mode 100644 index 000000000..66074d589 --- /dev/null +++ b/docs/supported-services/tideways.md @@ -0,0 +1,134 @@ +[comment]: # (Do not edit this file as it is autogenerated. Go to docs/individual-docs if you want to make edits.) + + +[comment]: # (Please add your documentation on top of this line) + +## services\.tideways\.enable + + + +Whether to enable Tideways profiler daemon + +It automatically installs Tideways PHP extension\. +\. + + + +*Type:* +boolean + + + +*Default:* +` false ` + + + +*Example:* +` true ` + + + +## services\.tideways\.apiKey + +Sets the API-Key for the Tideways Daemon\. + + + +*Type:* +string + + + +*Default:* +` "" ` + + + +## services\.tideways\.cliPackage + + + +Which package of tideways-cli to use + + + +*Type:* +package + + + +*Default:* +` pkgs.tideways-cli ` + + + +## services\.tideways\.daemonPackage + + + +Which package of tideways-daemon to use + + + +*Type:* +package + + + +*Default:* +` pkgs.tideways-daemon ` + + + +## services\.tideways\.environment + + + +Sets the Environment for Tideways Daemon\. + + + +*Type:* +string + + + +*Default:* +` "devenv" ` + + + +## services\.tideways\.profilingSpace + + + +When the profiling space is enabled, the default monitoring will be disabled\. + + + +*Type:* +boolean + + + +*Default:* +` true ` + + + +## services\.tideways\.service + + + +Sets the Service name for Tideways Daemon\. + + + +*Type:* +string + + + +*Default:* +` "" `