summary refs log tree commit diff
path: root/pkgs/tools/networking/wireguard-go/default.nix
blob: 44fadde8e4b08317d0d7aec4e9d5dd2648105a60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ lib, buildGoModule, fetchzip, testers, wireguard-go }:

buildGoModule rec {
  pname = "wireguard-go";
  version = "0.0.20220316";

  src = fetchzip {
    url = "https://git.zx2c4.com/wireguard-go/snapshot/wireguard-go-${version}.tar.xz";
    sha256 = "sha256-OQiG92idGwOXWX4H4HNmk2dmRM2+GtssJFzavhj1HxM=";
  };

  postPatch = ''
    # Skip formatting tests
    rm -f format_test.go
  '';

  vendorSha256 = "sha256-MrHkOj0YfvAm8zOowXzl23F1NPTCO0F8vMMGT/Y+nQ0=";

  subPackages = [ "." ];

  ldflags = [ "-s" "-w" ];

  postInstall = ''
    mv $out/bin/wireguard $out/bin/wireguard-go
  '';

  passthru.tests.version = testers.testVersion {
    package = wireguard-go;
    version = "v${version}";
  };

  meta = with lib; {
    description = "Userspace Go implementation of WireGuard";
    homepage = "https://git.zx2c4.com/wireguard-go/about/";
    license = licenses.mit;
    maintainers = with maintainers; [ elseym kirelagin yana zx2c4 ];
  };
}