nix build: Use Nix search path
That is, unless --file is specified, the Nix search path is synthesized into an attribute set. Thus you can say $ nix build nixpkgs.hello assuming $NIX_PATH contains an entry of the form "nixpkgs=...". This is more verbose than $ nix build hello but is less ambiguous.
This commit is contained in:
		
							parent
							
								
									22d6e31fc6
								
							
						
					
					
						commit
						d74236d1f2
					
				
					 5 changed files with 57 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -379,9 +379,9 @@ void EvalState::addPrimOp(const string & name,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void EvalState::getBuiltin(const string & name, Value & v)
 | 
			
		||||
Value & EvalState::getBuiltin(const string & name)
 | 
			
		||||
{
 | 
			
		||||
    v = *baseEnv.values[0]->attrs->find(symbols.create(name))->value;
 | 
			
		||||
    return *baseEnv.values[0]->attrs->find(symbols.create(name))->value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -462,7 +462,7 @@ void mkString(Value & v, const char * s)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void mkString(Value & v, const string & s, const PathSet & context)
 | 
			
		||||
Value & mkString(Value & v, const string & s, const PathSet & context)
 | 
			
		||||
{
 | 
			
		||||
    mkString(v, s.c_str());
 | 
			
		||||
    if (!context.empty()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -473,6 +473,7 @@ void mkString(Value & v, const string & s, const PathSet & context)
 | 
			
		|||
            v.string.context[n++] = dupString(i.c_str());
 | 
			
		||||
        v.string.context[n] = 0;
 | 
			
		||||
    }
 | 
			
		||||
    return v;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ struct Env
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void mkString(Value & v, const string & s, const PathSet & context = PathSet());
 | 
			
		||||
Value & mkString(Value & v, const string & s, const PathSet & context = PathSet());
 | 
			
		||||
 | 
			
		||||
void copyContext(const Value & v, PathSet & context);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -108,6 +108,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    void addToSearchPath(const string & s);
 | 
			
		||||
 | 
			
		||||
    SearchPath getSearchPath() { return searchPath; }
 | 
			
		||||
 | 
			
		||||
    Path checkSourcePath(const Path & path);
 | 
			
		||||
 | 
			
		||||
    /* Parse a Nix expression from the specified file. */
 | 
			
		||||
| 
						 | 
				
			
			@ -204,7 +206,7 @@ private:
 | 
			
		|||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    void getBuiltin(const string & name, Value & v);
 | 
			
		||||
    Value & getBuiltin(const string & name);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue