This reduces the difference between inherited and non-inherited attribute handling to the choice of which env to use (in recs and lets) by setting the AttrDef::e to a new ExprVar in the parser rather than carrying a separate AttrDef::v VarRef member. As an added bonus, this allows inherited attributes that inherit from a with to delay forcing evaluation of the with's attributes. Signed-off-by: Shea Levy <shea@shealevy.com>
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			466 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			466 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| let
 | |
|   pkgs_ = with pkgs; {
 | |
|     a = derivation {
 | |
|       name = "a";
 | |
|       system = builtins.currentSystem;
 | |
|       builder = "/bin/sh";
 | |
|       args = [ "-c" "touch $out" ];
 | |
|       inherit b;
 | |
|     };
 | |
| 
 | |
|     inherit b;
 | |
|   };
 | |
| 
 | |
|   packageOverrides = p: {
 | |
|     b = derivation {
 | |
|       name = "b-overridden";
 | |
|       system = builtins.currentSystem;
 | |
|       builder = "/bin/sh";
 | |
|       args = [ "-c" "touch $out" ];
 | |
|     };
 | |
|   };
 | |
| 
 | |
|   pkgs = pkgs_ // (packageOverrides pkgs_);
 | |
| in pkgs.a.b.name
 |