@@ -0,0 +1,28 @@
1+{ stdenv, buildGoPackage, fetchzip }:
2+
3+buildGoPackage rec {
4+ name = "wireguard-go-${version}";
5+ version = "0.0.20180514";
6+
7+ goPackagePath = "wireguard-go";
8+
9+ src = fetchzip {
10+ url = "https://git.zx2c4.com/wireguard-go/snapshot/wireguard-go-${version}.tar.xz";
11+ sha256 = "1i1w4vj8w353b92nfhs92k0f7fifrwi067qfmgckdk0kk76nv2id";
12+ };
13+
14+ goDeps = ./deps.nix;
15+
16+ postPatch = ''
17+ # Replace local imports so that go tools do not trip on them
18+ find . -name '*.go' -exec sed -i '/import (/,/)/s@"./@"${goPackagePath}/@' {} \;
19+ '';
20+
21+ meta = with stdenv.lib; {
22+ description = "Userspace Go implementation of WireGuard";
23+ homepage = https://git.zx2c4.com/wireguard-go/about/;
24+ license = licenses.gpl2;
25+ maintainers = with maintainers; [ kirelagin ];
26+ platforms = with platforms; linux ++ darwin ++ windows;
27+ };
28+}