diff --git a/doc/manual/expressions/advanced-attributes.xml b/doc/manual/expressions/advanced-attributes.xml index 07b0d97d3..372d03de7 100644 --- a/doc/manual/expressions/advanced-attributes.xml +++ b/doc/manual/expressions/advanced-attributes.xml @@ -11,7 +11,7 @@ attributes. - allowedReferences + allowedReferences The optional attribute allowedReferences specifies a list of legal @@ -32,7 +32,7 @@ allowedReferences = []; - allowedRequisites + allowedRequisites This attribute is similar to allowedReferences, but it specifies the legal @@ -50,7 +50,7 @@ allowedRequisites = [ foobar ]; - disallowedReferences + disallowedReferences The optional attribute disallowedReferences specifies a list of illegal @@ -67,7 +67,7 @@ disallowedReferences = [ foo ]; - disallowedRequisites + disallowedRequisites This attribute is similar to disallowedReferences, but it specifies illegal @@ -85,7 +85,7 @@ disallowedRequisites = [ foobar ]; - exportReferencesGraph + exportReferencesGraph This attribute allows builders access to the references graph of their inputs. The attribute is a list of @@ -124,7 +124,7 @@ derivation { - impureEnvVars + impureEnvVars 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" ... ]; - outputHash - outputHashAlgo - outputHashMode + outputHash + outputHashAlgo + outputHashMode These attributes declare that the derivation is a so-called fixed-output derivation, which @@ -282,7 +282,7 @@ stdenv.mkDerivation { - passAsFile + passAsFile 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"; - preferLocalBuild + preferLocalBuild If this attribute is set to true and - allowSubstitutes + allowSubstitutes - If this attribute is set to + + If this attribute is set to false, then Nix will always build this derivation; it will not try to substitute its outputs. This is useful for very trivial derivations (such as writeText in Nixpkgs) that are cheaper to - build than to substitute from a binary cache. + build than to substitute from a binary cache. + + You need to have a builder configured which satisfies + the derivation’s system attribute, since the + derivation cannot be substituted. Thus it is usually a good idea + to align system with + builtins.currentSystem when setting + allowSubstitutes to false. + For most trivial derivations this should be the case. + + diff --git a/local.mk b/local.mk index 921ea91cd..01ca8a295 100644 --- a/local.mk +++ b/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), \ $(eval $(call install-file-in, $(i), $(includedir)/nix, 0644))) + +$(GCH) $(PCH): src/libutil/util.hh config.h diff --git a/mk/precompiled-headers.mk b/mk/precompiled-headers.mk index 779389b26..1a727ba1b 100644 --- a/mk/precompiled-headers.mk +++ b/mk/precompiled-headers.mk @@ -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) diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 5df03da74..beb5e6b64 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -158,10 +158,10 @@ extern Verbosity verbosity; /* suppress msgs > this */ #define vomit(args...) printMsg(lvlVomit, args) template -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()); } diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 4bc91828b..20b96a85c 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -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 +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 -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 - BaseError(unsigned int status, Args... args) + BaseError(unsigned int status, const Args & ... args) : err(fmt(args...)) , status(status) { } template - BaseError(Args... args) + BaseError(const Args & ... args) : err(fmt(args...)) { } @@ -126,7 +136,7 @@ public: int errNo; template - SysError(Args... args) + SysError(const Args & ... args) : Error(addErrno(fmt(args...))) { } diff --git a/src/libutil/util.hh b/src/libutil/util.hh index ca0b5737c..c18d1b5a4 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -305,7 +305,7 @@ public: int status; template - ExecError(int status, Args... args) + ExecError(int status, const Args & ... args) : Error(args...), status(status) { } };