mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +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
|
// FIXME: use regular /archive URLs instead? api.github.com
|
||||||
// might have stricter rate limits.
|
// 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",
|
auto url = fmt("https://api.github.com/repos/%s/%s/tarball/%s",
|
||||||
refData->owner, refData->repo,
|
refData->owner, refData->repo,
|
||||||
fRef.rev ? fRef.rev->to_string(Base16, false)
|
fRef.rev ? fRef.rev->to_string(Base16, false)
|
||||||
: fRef.ref ? *fRef.ref : "master");
|
: 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",
|
auto result = getDownloader()->downloadCached(state.store, url, true, "source",
|
||||||
Hash(), nullptr, fRef.rev ? 1000000000 : settings.tarballTtl);
|
Hash(), nullptr, fRef.rev ? 1000000000 : settings.tarballTtl);
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,9 @@ public:
|
||||||
|
|
||||||
Setting<Paths> pluginFiles{this, {}, "plugin-files",
|
Setting<Paths> pluginFiles{this, {}, "plugin-files",
|
||||||
"Plugins to dynamically load at nix initialization time."};
|
"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