x.y.z or default (as originally proposed in https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html). For instance, an expression like stdenv.lib.attrByPath ["features" "ckSched"] false args can now be written as args.features.ckSched or false
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			401 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			401 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| with import ./lib.nix;
 | |
| 
 | |
| let
 | |
| 
 | |
|   as = { x.y.z = 123; a.b.c = 456; };
 | |
| 
 | |
|   bs = { foo.bar = "foo"; };
 | |
| 
 | |
|   or = x: y: x || y;
 | |
|   
 | |
| in
 | |
|   [ as.x.y.z
 | |
|     as.foo or "foo"
 | |
|     as.x.y.bla or as.a.b.c
 | |
|     as.a.b.c or as.x.y.z
 | |
|     as.x.y.bla or bs.foo.bar or "xyzzy"
 | |
|     as.x.y.bla or bs.bar.foo or "xyzzy"
 | |
|     123.bla or null.foo or "xyzzy"
 | |
|     # Backwards compatibility test.
 | |
|     (fold or [] [true false false])
 | |
|   ]
 |