forked from lix-project/lix
Added support for private github repositories
This commit is contained in:
parent
b4e367bf4a
commit
b3d33b02e3
|
@ -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