Skip to content

Commit c432861

Browse files
authored
wireguard-go: 0.0.20230223 -> 0-unstable-2023-12-11; unbreak (#396987)
2 parents a3ecc23 + 1c1e0be commit c432861

File tree

3 files changed

+74
-56
lines changed

3 files changed

+74
-56
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
lib,
3+
buildGoModule,
4+
fetchzip,
5+
testers,
6+
wireguard-go,
7+
}:
8+
9+
buildGoModule (
10+
finalAttrs:
11+
let
12+
rev = "12269c2761734b15625017d8565745096325392f";
13+
shortVer = "${finalAttrs.version} (${lib.substring 0 7 rev})";
14+
in
15+
{
16+
pname = "wireguard-go";
17+
version = "0-unstable-2023-12-11";
18+
19+
src = fetchzip {
20+
url = "https://git.zx2c4.com/wireguard-go/snapshot/wireguard-go-${rev}.tar.xz";
21+
hash = "sha256-br7/dwr/e4HvBGJXh+6lWqxBUezt5iZNy9BFqEA1bLk=";
22+
};
23+
24+
postPatch = ''
25+
# Skip formatting tests
26+
rm -f format_test.go
27+
28+
# Inject version
29+
printf 'package main\n\nconst Version = "${shortVer}"' > version.go
30+
'';
31+
32+
vendorHash = "sha256-RqZ/3+Xus5N1raiUTUpiKVBs/lrJQcSwr1dJib2ytwc=";
33+
34+
subPackages = [ "." ];
35+
36+
ldflags = [ "-s" ];
37+
38+
# No tests besides the formatting one are in root.
39+
# We can't override subPackages per-phase (and we don't
40+
# want to needlessly build packages that have build
41+
# constraints), so just use the upstream Makefile (that
42+
# runs `go test ./...`) to actually run the tests.
43+
checkPhase = ''
44+
runHook preCheck
45+
export GOFLAGS=''${GOFLAGS//-trimpath/}
46+
make test
47+
runHook postCheck
48+
'';
49+
50+
# Tests require networking.
51+
__darwinAllowLocalNetworking = finalAttrs.doCheck;
52+
53+
postInstall = ''
54+
mv $out/bin/wireguard $out/bin/wireguard-go
55+
'';
56+
57+
passthru.tests.version = testers.testVersion {
58+
package = wireguard-go;
59+
version = "v${shortVer}";
60+
};
61+
62+
meta = with lib; {
63+
description = "Userspace Go implementation of WireGuard";
64+
homepage = "https://git.zx2c4.com/wireguard-go/about/";
65+
license = licenses.mit;
66+
maintainers = with maintainers; [
67+
kirelagin
68+
winter
69+
zx2c4
70+
];
71+
mainProgram = "wireguard-go";
72+
};
73+
}
74+
)

pkgs/tools/networking/wireguard-go/default.nix

Lines changed: 0 additions & 54 deletions
This file was deleted.

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5668,8 +5668,6 @@ with pkgs;
56685668
inherit (darwin.apple_sdk.frameworks) Foundation IOBluetooth;
56695669
};
56705670

5671-
wireguard-go = callPackage ../tools/networking/wireguard-go { };
5672-
56735671
wring = nodePackages.wring;
56745672

56755673
wyrd = callPackage ../tools/misc/wyrd {

0 commit comments

Comments
 (0)