at master 2.0 kB view raw
1let 2 mkIfStateConfig = id: { 3 enable = true; 4 settings.interfaces.eth1 = { 5 addresses = [ "2001:0db8::${builtins.toString id}/64" ]; 6 link = { 7 state = "up"; 8 kind = "physical"; 9 }; 10 }; 11 }; 12in 13{ 14 name = "ifstate-initrd-partial-broken-config"; 15 16 nodes = { 17 server = 18 { lib, ... }: 19 { 20 imports = [ ../../modules/profiles/minimal.nix ]; 21 22 virtualisation.interfaces.eth1.vlan = 1; 23 24 # Initrd IfState enforces stage 2 ifstate using assertion. 25 networking.ifstate = { 26 enable = true; 27 settings.interfaces = { }; 28 }; 29 30 boot.initrd = { 31 network = { 32 enable = true; 33 ifstate = lib.mkMerge [ 34 (mkIfStateConfig 1) 35 { 36 allowIfstateToDrasticlyIncreaseInitrdSize = true; 37 38 # non-existent interface; ifstate should apply eth1 and do not distrupt the boot process 39 settings.interfaces.eth2 = { 40 addresses = [ "2001:0db8:b::dead:beef/64" ]; 41 link = { 42 state = "up"; 43 kind = "physical"; 44 }; 45 }; 46 } 47 ]; 48 }; 49 systemd = { 50 enable = true; 51 network.enable = false; 52 services.boot-blocker = { 53 before = [ "initrd.target" ]; 54 wantedBy = [ "initrd.target" ]; 55 script = "sleep infinity"; 56 serviceConfig.Type = "oneshot"; 57 }; 58 }; 59 }; 60 }; 61 62 client = { 63 imports = [ ../../modules/profiles/minimal.nix ]; 64 65 virtualisation.interfaces.eth1.vlan = 1; 66 67 networking.ifstate = mkIfStateConfig 2; 68 }; 69 }; 70 71 testScript = # python 72 '' 73 start_all() 74 client.wait_for_unit("network.target") 75 76 # try to ping the server from the client 77 client.wait_until_succeeds("ping -c 1 2001:0db8::1") 78 ''; 79}