| 
									
										
										
										
											2018-11-11 17:41:11 +09:00
										 |  |  | { system ? builtins.currentSystem, | 
					
						
							|  |  |  |   config ? {}, | 
					
						
							|  |  |  |   pkgs ? import ../.. { inherit system config; } | 
					
						
							|  |  |  | }: | 
					
						
							| 
									
										
										
										
											2018-02-09 18:40:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  | let | 
					
						
							| 
									
										
										
										
											2019-12-01 03:16:32 +01:00
										 |  |  |   inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest; | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  | in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: { | 
					
						
							|  |  |  |   name = pkgs.lib.optionalString (!predictable) "un" + "predictable" | 
					
						
							|  |  |  |        + pkgs.lib.optionalString withNetworkd "Networkd"; | 
					
						
							|  |  |  |   value = makeTest { | 
					
						
							|  |  |  |     name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}"; | 
					
						
							|  |  |  |     meta = {}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-20 20:56:59 +00:00
										 |  |  |     machine = { lib, ... }: { | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  |       networking.usePredictableInterfaceNames = lib.mkForce predictable; | 
					
						
							|  |  |  |       networking.useNetworkd = withNetworkd; | 
					
						
							|  |  |  |       networking.dhcpcd.enable = !withNetworkd; | 
					
						
							| 
									
										
										
										
											2019-09-23 16:37:58 +02:00
										 |  |  |       networking.useDHCP = !withNetworkd; | 
					
						
							| 
									
										
										
										
											2019-09-22 17:14:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       # Check if predictable interface names are working in stage-1 | 
					
						
							|  |  |  |       boot.initrd.postDeviceCommands = ''
 | 
					
						
							|  |  |  |         ip link | 
					
						
							|  |  |  |         ip link show eth0 ${if predictable then "&&" else "||"} exit 1 | 
					
						
							|  |  |  |       '';
 | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-02-09 18:40:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  |     testScript = ''
 | 
					
						
							| 
									
										
										
										
											2019-12-01 03:16:32 +01:00
										 |  |  |       print(machine.succeed("ip link")) | 
					
						
							|  |  |  |       machine.${if predictable then "fail" else "succeed"}("ip link show eth0") | 
					
						
							| 
									
										
										
										
											2018-04-29 15:28:33 +02:00
										 |  |  |     '';
 | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | }) [[true false] [true false]]) |