mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Merge branch 'considerate/scp-like-urls' of https://github.com/considerate/nix
This commit is contained in:
commit
46753b5e9c
1 changed files with 19 additions and 6 deletions
|
@ -81,10 +81,24 @@ std::string fixURIForGit(std::string uri, EvalState & state)
|
||||||
return fixURI(uri, state);
|
return fixURI(uri, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addURI(EvalState &state, fetchers::Attrs &attrs, Symbol name, std::string v)
|
void addURI(
|
||||||
{
|
EvalState &state,
|
||||||
|
fetchers::Attrs &attrs,
|
||||||
|
Symbol name,
|
||||||
|
std::string v,
|
||||||
|
const std::optional<std::string> type
|
||||||
|
) {
|
||||||
string n(name);
|
string n(name);
|
||||||
attrs.emplace(name, n == "url" ? fixURI(v, state) : v);
|
if (n == "url") {
|
||||||
|
if (type == "git") {
|
||||||
|
attrs.emplace("type", "git");
|
||||||
|
attrs.emplace(name, fixURIForGit(v, state));
|
||||||
|
} else {
|
||||||
|
attrs.emplace(name, fixURI(v, state));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
attrs.emplace(name, v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FetchTreeParams {
|
struct FetchTreeParams {
|
||||||
|
@ -117,10 +131,9 @@ static void fetchTree(
|
||||||
state,
|
state,
|
||||||
attrs,
|
attrs,
|
||||||
attr.name,
|
attr.name,
|
||||||
state.coerceToString(*attr.pos, *attr.value, context, false, false)
|
state.coerceToString(*attr.pos, *attr.value, context, false, false),
|
||||||
|
type
|
||||||
);
|
);
|
||||||
else if (attr.value->type() == nString)
|
|
||||||
addURI(state, attrs, attr.name, attr.value->string.s);
|
|
||||||
else if (attr.value->type() == nBool)
|
else if (attr.value->type() == nBool)
|
||||||
attrs.emplace(attr.name, Explicit<bool>{attr.value->boolean});
|
attrs.emplace(attr.name, Explicit<bool>{attr.value->boolean});
|
||||||
else if (attr.value->type() == nInt)
|
else if (attr.value->type() == nInt)
|
||||||
|
|
Loading…
Reference in a new issue