forked from lix-project/lix
Merge remote-tracking branch 'origin/master' into flakes
This commit is contained in:
commit
ab88f4bbd4
|
@ -11,7 +11,7 @@ attributes.</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><varname>allowedReferences</varname></term>
|
<varlistentry xml:id="adv-attr-allowedReferences"><term><varname>allowedReferences</varname></term>
|
||||||
|
|
||||||
<listitem><para>The optional attribute
|
<listitem><para>The optional attribute
|
||||||
<varname>allowedReferences</varname> specifies a list of legal
|
<varname>allowedReferences</varname> specifies a list of legal
|
||||||
|
@ -32,7 +32,7 @@ allowedReferences = [];
|
||||||
</varlistentry>
|
</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
|
<listitem><para>This attribute is similar to
|
||||||
<varname>allowedReferences</varname>, but it specifies the legal
|
<varname>allowedReferences</varname>, but it specifies the legal
|
||||||
|
@ -50,7 +50,7 @@ allowedRequisites = [ foobar ];
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><varname>disallowedReferences</varname></term>
|
<varlistentry xml:id="adv-attr-disallowedReferences"><term><varname>disallowedReferences</varname></term>
|
||||||
|
|
||||||
<listitem><para>The optional attribute
|
<listitem><para>The optional attribute
|
||||||
<varname>disallowedReferences</varname> specifies a list of illegal
|
<varname>disallowedReferences</varname> specifies a list of illegal
|
||||||
|
@ -67,7 +67,7 @@ disallowedReferences = [ foo ];
|
||||||
</varlistentry>
|
</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
|
<listitem><para>This attribute is similar to
|
||||||
<varname>disallowedReferences</varname>, but it specifies illegal
|
<varname>disallowedReferences</varname>, but it specifies illegal
|
||||||
|
@ -85,7 +85,7 @@ disallowedRequisites = [ foobar ];
|
||||||
</varlistentry>
|
</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
|
<listitem><para>This attribute allows builders access to the
|
||||||
references graph of their inputs. The attribute is a list of
|
references graph of their inputs. The attribute is a list of
|
||||||
|
@ -124,7 +124,7 @@ derivation {
|
||||||
</varlistentry>
|
</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
|
<listitem><para>This attribute allows you to specify a list of
|
||||||
environment variables that should be passed from the environment
|
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">
|
<varlistentry xml:id="fixed-output-drvs">
|
||||||
<term><varname>outputHash</varname></term>
|
<term xml:id="adv-attr-outputHash"><varname>outputHash</varname></term>
|
||||||
<term><varname>outputHashAlgo</varname></term>
|
<term xml:id="adv-attr-outputHashAlgo"><varname>outputHashAlgo</varname></term>
|
||||||
<term><varname>outputHashMode</varname></term>
|
<term xml:id="adv-attr-outputHashMode"><varname>outputHashMode</varname></term>
|
||||||
|
|
||||||
<listitem><para>These attributes declare that the derivation is a
|
<listitem><para>These attributes declare that the derivation is a
|
||||||
so-called <emphasis>fixed-output derivation</emphasis>, which
|
so-called <emphasis>fixed-output derivation</emphasis>, which
|
||||||
|
@ -282,7 +282,7 @@ stdenv.mkDerivation {
|
||||||
</varlistentry>
|
</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
|
<listitem><para>A list of names of attributes that should be
|
||||||
passed via files rather than environment variables. For example,
|
passed via files rather than environment variables. For example,
|
||||||
|
@ -309,7 +309,7 @@ big = "a very long string";
|
||||||
</varlistentry>
|
</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
|
<listitem><para>If this attribute is set to
|
||||||
<literal>true</literal> and <link
|
<literal>true</literal> and <link
|
||||||
|
@ -323,14 +323,25 @@ big = "a very long string";
|
||||||
</varlistentry>
|
</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
|
<literal>false</literal>, then Nix will always build this
|
||||||
derivation; it will not try to substitute its outputs. This is
|
derivation; it will not try to substitute its outputs. This is
|
||||||
useful for very trivial derivations (such as
|
useful for very trivial derivations (such as
|
||||||
<function>writeText</function> in Nixpkgs) that are cheaper to
|
<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 derivation’s <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>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
2
local.mk
2
local.mk
|
@ -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), \
|
$(foreach i, config.h $(call rwildcard, src/lib*, *.hh), \
|
||||||
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
||||||
|
|
||||||
|
$(GCH) $(PCH): src/libutil/util.hh config.h
|
||||||
|
|
|
@ -8,14 +8,14 @@ GCH = $(buildprefix)precompiled-headers.h.gch
|
||||||
$(GCH): precompiled-headers.h
|
$(GCH): precompiled-headers.h
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
@mkdir -p "$(dir $@)"
|
@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 = $(buildprefix)precompiled-headers.h.pch
|
||||||
|
|
||||||
$(PCH): precompiled-headers.h
|
$(PCH): precompiled-headers.h
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
@mkdir -p "$(dir $@)"
|
@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)
|
clean-files += $(GCH) $(PCH)
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,10 @@ extern Verbosity verbosity; /* suppress msgs > this */
|
||||||
#define vomit(args...) printMsg(lvlVomit, args)
|
#define vomit(args...) printMsg(lvlVomit, args)
|
||||||
|
|
||||||
template<typename... 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);
|
boost::format f(fs);
|
||||||
nop{boost::io::detail::feed(f, args)...};
|
formatHelper(f, args...);
|
||||||
logger->warn(f.str());
|
logger->warn(f.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,16 @@ struct FormatOrString
|
||||||
... a_n’. However, ‘fmt(s)’ is equivalent to ‘s’ (so no %-expansion
|
... a_n’. However, ‘fmt(s)’ is equivalent to ‘s’ (so no %-expansion
|
||||||
takes place). */
|
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)
|
inline std::string fmt(const std::string & s)
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
|
@ -67,11 +77,11 @@ inline std::string fmt(const FormatOrString & fs)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
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);
|
boost::format f(fs);
|
||||||
f.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
|
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();
|
return f.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,14 +97,14 @@ public:
|
||||||
unsigned int status = 1; // exit status
|
unsigned int status = 1; // exit status
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
BaseError(unsigned int status, Args... args)
|
BaseError(unsigned int status, const Args & ... args)
|
||||||
: err(fmt(args...))
|
: err(fmt(args...))
|
||||||
, status(status)
|
, status(status)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
BaseError(Args... args)
|
BaseError(const Args & ... args)
|
||||||
: err(fmt(args...))
|
: err(fmt(args...))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -126,7 +136,7 @@ public:
|
||||||
int errNo;
|
int errNo;
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
SysError(Args... args)
|
SysError(const Args & ... args)
|
||||||
: Error(addErrno(fmt(args...)))
|
: Error(addErrno(fmt(args...)))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ public:
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
ExecError(int status, Args... args)
|
ExecError(int status, const Args & ... args)
|
||||||
: Error(args...), status(status)
|
: Error(args...), status(status)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue