nix search: Ignore top-level eval errors
$NIX_PATH may contain elements that don't evaluate to an attrset (like "nixos-config"), so ignore those.
This commit is contained in:
		
							parent
							
								
									fc3568e263
								
							
						
					
					
						commit
						57a30e101b
					
				
					 2 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -16,6 +16,8 @@ Value * SourceExprCommand::getSourceExpr(EvalState & state)
 | 
			
		|||
{
 | 
			
		||||
    if (vSourceExpr) return vSourceExpr;
 | 
			
		||||
 | 
			
		||||
    auto sToplevel = state.symbols.create("_toplevel");
 | 
			
		||||
 | 
			
		||||
    vSourceExpr = state.allocValue();
 | 
			
		||||
 | 
			
		||||
    if (file != "") {
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +31,9 @@ Value * SourceExprCommand::getSourceExpr(EvalState & state)
 | 
			
		|||
 | 
			
		||||
        auto searchPath = state.getSearchPath();
 | 
			
		||||
 | 
			
		||||
        state.mkAttrs(*vSourceExpr, searchPath.size());
 | 
			
		||||
        state.mkAttrs(*vSourceExpr, searchPath.size() + 1);
 | 
			
		||||
 | 
			
		||||
        mkBool(*state.allocAttr(*vSourceExpr, sToplevel), true);
 | 
			
		||||
 | 
			
		||||
        std::unordered_set<std::string> seen;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue