diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-04-16 12:23:56 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-04-16 12:23:56 +0200 |
commit | 3a5493bfe87598398c1a0d7c4f3fef992ff9e15f (patch) | |
tree | 183a974ceda5b002864cf29a2d50f744cb486e74 /src/libexpr | |
parent | dd935404b2cdb4f15991f6ff651d41415e66fd69 (diff) | |
parent | b3d33b02e3fc40c7bd8f602334287825e7e6333d (diff) |
Merge remote-tracking branch 'tweag/privateGithub' into flakes
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops/flake.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc index 3c1cffba3..1b0b1eba7 100644 --- a/src/libexpr/primops/flake.cc +++ b/src/libexpr/primops/flake.cc @@ -226,13 +226,15 @@ static FlakeSourceInfo fetchFlake(EvalState & state, const FlakeRef flakeRef, bo // FIXME: use regular /archive URLs instead? api.github.com // might have stricter rate limits. - // FIXME: support passing auth tokens for private repos. - auto url = fmt("https://api.github.com/repos/%s/%s/tarball/%s", refData->owner, refData->repo, fRef.rev ? fRef.rev->to_string(Base16, false) : fRef.ref ? *fRef.ref : "master"); + std::string accessToken = settings.githubAccessToken.get(); + if (accessToken != "") + url += "?access_token=" + accessToken; + auto result = getDownloader()->downloadCached(state.store, url, true, "source", Hash(), nullptr, fRef.rev ? 1000000000 : settings.tarballTtl); |