1 { kernelPackages ? null }:
3 import ../make-test-python.nix ({ pkgs, lib, ... }:
5 wg-snakeoil-keys = import ./snakeoil-keys.nix;
6 peer = (import ./make-peer.nix) { inherit lib; };
10 meta = with pkgs.lib.maintainers; {
11 maintainers = [ d-xo ];
19 boot = lib.mkIf (kernelPackages != null) { inherit kernelPackages; };
20 networking.firewall.allowedUDPPorts = [ 23542 ];
21 networking.wg-quick.interfaces.wg0 = {
22 address = [ "10.23.42.1/32" "fc00::1/128" ];
25 inherit (wg-snakeoil-keys.peer0) privateKey;
27 peers = lib.singleton {
28 allowedIPs = [ "10.23.42.2/32" "fc00::2/128" ];
30 inherit (wg-snakeoil-keys.peer1) publicKey;
33 dns = [ "10.23.42.2" "fc00::2" "wg0" ];
42 boot = lib.mkIf (kernelPackages != null) { inherit kernelPackages; };
43 networking.useNetworkd = true;
44 networking.wg-quick.interfaces.wg0 = {
45 address = [ "10.23.42.2/32" "fc00::2/128" ];
46 inherit (wg-snakeoil-keys.peer1) privateKey;
48 peers = lib.singleton {
49 allowedIPs = [ "0.0.0.0/0" "::/0" ];
50 endpoint = "192.168.0.1:23542";
51 persistentKeepalive = 25;
53 inherit (wg-snakeoil-keys.peer0) publicKey;
56 dns = [ "10.23.42.1" "fc00::1" "wg0" ];
65 peer0.wait_for_unit("wg-quick-wg0.service")
66 peer1.wait_for_unit("wg-quick-wg0.service")
68 peer1.succeed("ping -c5 fc00::1")
69 peer1.succeed("ping -c5 10.23.42.1")