1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 12:21:48 +02:00

Add priority setting to stores

This allows overriding the priority of substituters, e.g.

  $ nix-store --store ~/my-nix/ -r /nix/store/df3m4da96d84ljzxx4mygfshm1p0r2n3-geeqie-1.4 \
    --substituters 'http://cache.nixos.org?priority=100 daemon?priority=10'

Fixes #3264.
This commit is contained in:
Eelco Dolstra 2019-12-17 17:17:53 +01:00
parent 54bf5ba422
commit f8abbdd456
13 changed files with 51 additions and 47 deletions

View file

@ -154,6 +154,11 @@ AbstractSetting::AbstractSetting(
{
}
void AbstractSetting::setDefault(const std::string & str)
{
if (!overriden) set(str);
}
void AbstractSetting::toJSON(JSONPlaceholder & out)
{
out.write(to_string());
@ -185,7 +190,7 @@ template<> void BaseSetting<std::string>::set(const std::string & str)
value = str;
}
template<> std::string BaseSetting<std::string>::to_string()
template<> std::string BaseSetting<std::string>::to_string() const
{
return value;
}
@ -199,7 +204,7 @@ void BaseSetting<T>::set(const std::string & str)
}
template<typename T>
std::string BaseSetting<T>::to_string()
std::string BaseSetting<T>::to_string() const
{
static_assert(std::is_integral<T>::value, "Integer required.");
return std::to_string(value);
@ -215,7 +220,7 @@ template<> void BaseSetting<bool>::set(const std::string & str)
throw UsageError("Boolean setting '%s' has invalid value '%s'", name, str);
}
template<> std::string BaseSetting<bool>::to_string()
template<> std::string BaseSetting<bool>::to_string() const
{
return value ? "true" : "false";
}
@ -239,7 +244,7 @@ template<> void BaseSetting<Strings>::set(const std::string & str)
value = tokenizeString<Strings>(str);
}
template<> std::string BaseSetting<Strings>::to_string()
template<> std::string BaseSetting<Strings>::to_string() const
{
return concatStringsSep(" ", value);
}
@ -256,7 +261,7 @@ template<> void BaseSetting<StringSet>::set(const std::string & str)
value = tokenizeString<StringSet>(str);
}
template<> std::string BaseSetting<StringSet>::to_string()
template<> std::string BaseSetting<StringSet>::to_string() const
{
return concatStringsSep(" ", value);
}