From 62a6eeb1f3da0a5954ad2da54c454eb7fc1c6e5d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 26 May 2014 17:02:22 +0200 Subject: Make the Nix search path declarative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nix search path lookups like are now desugared to ‘findFile nixPath ’, where ‘findFile’ is a new primop. Thus you can override the search path simply by saying let nixPath = [ { prefix = "nixpkgs"; path = "/my-nixpkgs"; } ]; in ... ... In conjunction with ‘scopedImport’ (commit c273c15cb13bb86420dda1e5341a4e19517532b5), the Nix search path can be propagated across imports, e.g. let overrides = { nixPath = [ ... ] ++ builtins.nixPath; import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; builtins = builtins // overrides; }; in scopedImport overrides ./nixos --- src/libexpr/eval.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libexpr/eval.hh') diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 200ec75e0f92..aa706cf98359 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -86,6 +86,9 @@ typedef std::map SrcToStore; std::ostream & operator << (std::ostream & str, const Value & v); +typedef list > SearchPath; + + class EvalState { public: @@ -111,7 +114,6 @@ private: #endif FileEvalCache fileEvalCache; - typedef list > SearchPath; SearchPath searchPath; public: @@ -137,6 +139,7 @@ public: /* Look up a file in the search path. */ Path findFile(const string & path); + Path findFile(SearchPath & searchPath, const string & path); /* Evaluate an expression to normal form, storing the result in value `v'. */ -- cgit 1.4.1