From 2b4794f941ceb73cad80758fc8f34fa8281aa511 Mon Sep 17 00:00:00 2001 From: Stefano Mazzucco Date: Tue, 11 Feb 2020 20:38:15 +0000 Subject: [PATCH] aws-sam-cli: add argument to conditionally enable telemetry If someone really wants to opt into telemetry, they can do so by setting `enableTelemetry` to `true` (the default is `false`), in which case the wrapper that sets `SAM_CLI_TELEMETRY` to `0` will not be created. Note that this actually allows a user to optionally disable telemetry from the command line or the (poorly documented) configuration in `~/.aws-sam/metadata.json`. The downside is telemetry will be enabled at least on the first run, causing a unique installation ID to be saved in the configuration file. --- pkgs/development/tools/aws-sam-cli/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index 916ff325b43b..09a61ef564f6 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -1,5 +1,6 @@ { lib , python +, enableTelemetry ? false }: let @@ -83,7 +84,7 @@ buildPythonApplication rec { tomlkit ]; - postFixup = '' + postFixup = if enableTelemetry then "echo aws-sam-cli TELEMETRY IS ENABLED" else '' # Disable telemetry: https://github.com/awslabs/aws-sam-cli/issues/1272 wrapProgram $out/bin/sam --set SAM_CLI_TELEMETRY 0 '';