jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.2k stars 192 forks source link

internal/boxcli: add `devbox cache credentials` #1960

Closed gcurtis closed 4 months ago

gcurtis commented 4 months ago

The devbox cache credentials subcommand prints out short-lived AWS STS credentials that grant access to the user's Nix cache.

The output follows the format described in aws help config-vars under Sourcing Credentials From External Processes. This allows the AWS CLI/SDKs to obtain credentials from Devbox. For example:

[default]
credential_process = /usr/local/bin/devbox cache credentials

Because Nix uses the AWS SDK's default credential chain, this allows it to automatically authenticate with private Devbox caches.

Note: this can be improved by using the newer credentials-only API endpoint, which is faster.