Merge remote-tracking branch 'origin/master' into flakes

This commit is contained in:
Eelco Dolstra 2019-12-05 20:53:32 +01:00
commit ab88f4bbd4
6 changed files with 47 additions and 24 deletions

View file

@ -11,7 +11,7 @@ attributes.</para>
<variablelist>
<varlistentry><term><varname>allowedReferences</varname></term>
<varlistentry xml:id="adv-attr-allowedReferences"><term><varname>allowedReferences</varname></term>
<listitem><para>The optional attribute
<varname>allowedReferences</varname> specifies a list of legal
@ -32,7 +32,7 @@ allowedReferences = [];
</varlistentry>
<varlistentry><term><varname>allowedRequisites</varname></term>
<varlistentry xml:id="adv-attr-allowedRequisites"><term><varname>allowedRequisites</varname></term>
<listitem><para>This attribute is similar to
<varname>allowedReferences</varname>, but it specifies the legal
@ -50,7 +50,7 @@ allowedRequisites = [ foobar ];
</varlistentry>
<varlistentry><term><varname>disallowedReferences</varname></term>
<varlistentry xml:id="adv-attr-disallowedReferences"><term><varname>disallowedReferences</varname></term>
<listitem><para>The optional attribute
<varname>disallowedReferences</varname> specifies a list of illegal
@ -67,7 +67,7 @@ disallowedReferences = [ foo ];
</varlistentry>
<varlistentry><term><varname>disallowedRequisites</varname></term>
<varlistentry xml:id="adv-attr-disallowedRequisites"><term><varname>disallowedRequisites</varname></term>
<listitem><para>This attribute is similar to
<varname>disallowedReferences</varname>, but it specifies illegal
@ -85,7 +85,7 @@ disallowedRequisites = [ foobar ];
</varlistentry>
<varlistentry><term><varname>exportReferencesGraph</varname></term>
<varlistentry xml:id="adv-attr-exportReferencesGraph"><term><varname>exportReferencesGraph</varname></term>
<listitem><para>This attribute allows builders access to the
references graph of their inputs. The attribute is a list of
@ -124,7 +124,7 @@ derivation {
</varlistentry>
<varlistentry><term><varname>impureEnvVars</varname></term>
<varlistentry xml:id="adv-attr-impureEnvVars"><term><varname>impureEnvVars</varname></term>
<listitem><para>This attribute allows you to specify a list of
environment variables that should be passed from the environment
@ -158,9 +158,9 @@ impureEnvVars = [ "http_proxy" "https_proxy" <replaceable>...</replaceable> ];
<varlistentry xml:id="fixed-output-drvs">
<term><varname>outputHash</varname></term>
<term><varname>outputHashAlgo</varname></term>
<term><varname>outputHashMode</varname></term>
<term xml:id="adv-attr-outputHash"><varname>outputHash</varname></term>
<term xml:id="adv-attr-outputHashAlgo"><varname>outputHashAlgo</varname></term>
<term xml:id="adv-attr-outputHashMode"><varname>outputHashMode</varname></term>
<listitem><para>These attributes declare that the derivation is a
so-called <emphasis>fixed-output derivation</emphasis>, which
@ -282,7 +282,7 @@ stdenv.mkDerivation {
</varlistentry>
<varlistentry><term><varname>passAsFile</varname></term>
<varlistentry xml:id="adv-attr-passAsFile"><term><varname>passAsFile</varname></term>
<listitem><para>A list of names of attributes that should be
passed via files rather than environment variables. For example,
@ -309,7 +309,7 @@ big = "a very long string";
</varlistentry>
<varlistentry><term><varname>preferLocalBuild</varname></term>
<varlistentry xml:id="adv-attr-preferLocalBuild"><term><varname>preferLocalBuild</varname></term>
<listitem><para>If this attribute is set to
<literal>true</literal> and <link
@ -323,14 +323,25 @@ big = "a very long string";
</varlistentry>
<varlistentry><term><varname>allowSubstitutes</varname></term>
<varlistentry xml:id="adv-attr-allowSubstitutes"><term><varname>allowSubstitutes</varname></term>
<listitem><para>If this attribute is set to
<listitem>
<para>If this attribute is set to
<literal>false</literal>, then Nix will always build this
derivation; it will not try to substitute its outputs. This is
useful for very trivial derivations (such as
<function>writeText</function> in Nixpkgs) that are cheaper to
build than to substitute from a binary cache.</para></listitem>
build than to substitute from a binary cache.</para>
<note><para>You need to have a builder configured which satisfies
the derivations <literal>system</literal> attribute, since the
derivation cannot be substituted. Thus it is usually a good idea
to align <literal>system</literal> with
<literal>builtins.currentSystem</literal> when setting
<literal>allowSubstitutes</literal> to <literal>false</literal>.
For most trivial derivations this should be the case.
</para></note>
</listitem>
</varlistentry>

View file

@ -10,3 +10,5 @@ GLOBAL_CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I
$(foreach i, config.h $(call rwildcard, src/lib*, *.hh), \
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
$(GCH) $(PCH): src/libutil/util.hh config.h

View file

@ -8,14 +8,14 @@ GCH = $(buildprefix)precompiled-headers.h.gch
$(GCH): precompiled-headers.h
@rm -f $@
@mkdir -p "$(dir $@)"
$(trace-gen) $(CXX) -x c++-header -o $@ $^ $(GLOBAL_CXXFLAGS)
$(trace-gen) $(CXX) -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS)
PCH = $(buildprefix)precompiled-headers.h.pch
$(PCH): precompiled-headers.h
@rm -f $@
@mkdir -p "$(dir $@)"
$(trace-gen) $(CXX) -x c++-header -o $@ $^ $(GLOBAL_CXXFLAGS)
$(trace-gen) $(CXX) -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS)
clean-files += $(GCH) $(PCH)

View file

@ -158,10 +158,10 @@ extern Verbosity verbosity; /* suppress msgs > this */
#define vomit(args...) printMsg(lvlVomit, args)
template<typename... Args>
inline void warn(const std::string & fs, Args... args)
inline void warn(const std::string & fs, const Args & ... args)
{
boost::format f(fs);
nop{boost::io::detail::feed(f, args)...};
formatHelper(f, args...);
logger->warn(f.str());
}

View file

@ -51,6 +51,16 @@ struct FormatOrString
... a_n. However, fmt(s) is equivalent to s (so no %-expansion
takes place). */
inline void formatHelper(boost::format & f)
{
}
template<typename T, typename... Args>
inline void formatHelper(boost::format & f, const T & x, const Args & ... args)
{
formatHelper(f % x, args...);
}
inline std::string fmt(const std::string & s)
{
return s;
@ -67,11 +77,11 @@ inline std::string fmt(const FormatOrString & fs)
}
template<typename... Args>
inline std::string fmt(const std::string & fs, Args... args)
inline std::string fmt(const std::string & fs, const Args & ... args)
{
boost::format f(fs);
f.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
nop{boost::io::detail::feed(f, args)...};
formatHelper(f, args...);
return f.str();
}
@ -87,14 +97,14 @@ public:
unsigned int status = 1; // exit status
template<typename... Args>
BaseError(unsigned int status, Args... args)
BaseError(unsigned int status, const Args & ... args)
: err(fmt(args...))
, status(status)
{
}
template<typename... Args>
BaseError(Args... args)
BaseError(const Args & ... args)
: err(fmt(args...))
{
}
@ -126,7 +136,7 @@ public:
int errNo;
template<typename... Args>
SysError(Args... args)
SysError(const Args & ... args)
: Error(addErrno(fmt(args...)))
{ }

View file

@ -305,7 +305,7 @@ public:
int status;
template<typename... Args>
ExecError(int status, Args... args)
ExecError(int status, const Args & ... args)
: Error(args...), status(status)
{ }
};