From a7f74c1fa4b89c5829f5896842eb7248c820704c Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Thu, 17 Sep 2026 15:05:36 +0100 Subject: Use GitHub credentials for Nix when available --- nix/with-github-auth.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nix/with-github-auth.sh (limited to 'nix') diff --git a/nix/with-github-auth.sh b/nix/with-github-auth.sh new file mode 100644 index 0000000..8b7002a --- /dev/null +++ b/nix/with-github-auth.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -eu + +if command -v gh >/dev/null 2>&1 && github_token=$(gh auth token --hostname github.com 2>/dev/null); then + NIX_CONFIG="${NIX_CONFIG:-} +extra-access-tokens = github.com=$github_token" + export NIX_CONFIG + unset github_token +fi + +exec "$@" -- cgit v1.3.1