vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / mycelium / default.nix
blob956a822a21860fa1fa225284a95683b5f01dfdb0
1 import ../make-test-python.nix ({ lib, ... }: let
2   peer1-ip = "538:f40f:1c51:9bd9:9569:d3f6:d0a1:b2df";
3   peer2-ip = "5b6:6776:fee0:c1f3:db00:b6a8:d013:d38f";
4 in
5   {
6     name = "mycelium";
7     meta.maintainers = with lib.maintainers; [ lassulus ];
9     nodes = {
11       peer1 = { config, pkgs, ... }: {
12         virtualisation.vlans = [ 1 ];
13         networking.interfaces.eth1.ipv4.addresses = [{
14           address = "192.168.1.11";
15           prefixLength = 24;
16         }];
18         services.mycelium = {
19           enable = true;
20           addHostedPublicNodes = false;
21           openFirewall = true;
22           keyFile = ./peer1.key;
23           peers = [
24             "quic://192.168.1.12:9651"
25             "tcp://192.168.1.12:9651"
26           ];
27         };
28       };
30       peer2 = { config, pkgs, ... }: {
31         virtualisation.vlans = [ 1 ];
32         networking.interfaces.eth1.ipv4.addresses = [{
33           address = "192.168.1.12";
34           prefixLength = 24;
35         }];
37         services.mycelium = {
38           enable = true;
39           addHostedPublicNodes = false;
40           openFirewall = true;
41           keyFile = ./peer2.key;
42         };
43       };
44     };
46     testScript = ''
47       start_all()
49       peer1.wait_for_unit("network-online.target")
50       peer2.wait_for_unit("network-online.target")
51       peer1.wait_for_unit("mycelium.service")
52       peer2.wait_for_unit("mycelium.service")
54       peer1.succeed("mycelium peers list | grep 192.168.1.12")
55       peer2.succeed("mycelium peers list | grep 192.168.1.11")
57       peer1.succeed("ping -c5 ${peer2-ip}")
58       peer2.succeed("ping -c5 ${peer1-ip}")
59     '';
60   })