Unverified Commit ec7f8fa4 authored by Benedikt Ritter's avatar Benedikt Ritter
Browse files

gh: opt out of telemetry collection by default

Starting with release 2.91.0 gh sends pseudonymized telemetry data to
GitHub. Disabling it requires and explicit opt-out.

Context: https://github.blog/changelog/2026-04-22-github-cli-opt-out-usage-telemetry/

This changes makes telemetry collection opt in. If users really want to
share data with GitHub, they can `overrideAttrs` and explicitly set the
new `enableTelemetry` parameter to `true`.
parent 7d12338e
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -5,7 +5,8 @@
  installShellFiles,
  stdenv,
  testers,
  gh,
  makeWrapper,
  enableTelemetry ? false,
}:

buildGoModule (finalAttrs: {
@@ -21,7 +22,10 @@ buildGoModule (finalAttrs: {

  vendorHash = "sha256-4xZAcwn9/vUTkahIlqwyGb/2SYYGusdXY4nye8ldp/g=";

  nativeBuildInputs = [ installShellFiles ];
  nativeBuildInputs = [
    installShellFiles
    makeWrapper
  ];

  # N.B.: using the Makefile is intentional.
  # We pass "nixpkgs" for build.Date to avoid `gh --version` reporting a very old date.
@@ -35,6 +39,10 @@ buildGoModule (finalAttrs: {
    runHook preInstall
    install -Dm755 bin/gh -t $out/bin
  ''
  + lib.optionalString (!enableTelemetry) ''
    wrapProgram $out/bin/gh \
      --set GH_TELEMETRY false
  ''
  + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installManPage share/man/*/*.[1-9]

@@ -51,7 +59,7 @@ buildGoModule (finalAttrs: {
  doCheck = false;

  passthru.tests.version = testers.testVersion {
    package = gh;
    package = finalAttrs.finalPackage;
  };

  meta = {