mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Merge remote-tracking branch 'tweag/privateGithub' into flakes
This commit is contained in:
commit
3a5493bfe8
2 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -344,6 +344,9 @@ public:
|
|||
|
||||
Setting<Paths> pluginFiles{this, {}, "plugin-files",
|
||||
"Plugins to dynamically load at nix initialization time."};
|
||||
|
||||
Setting<std::string> githubAccessToken{this, "", "github-acces-token",
|
||||
"GitHub access token to get access to GitHub data through the GitHub API for github:<..> flakes."};
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue