1{
2 lib,
3 buildGoModule,
4 mullvad,
5}:
6buildGoModule {
7 pname = "libwg";
8
9 inherit (mullvad)
10 version
11 src
12 ;
13
14 modRoot = "wireguard-go-rs/libwg";
15 proxyVendor = true;
16 vendorHash = "sha256-uzPtA9RBP5m8+18YBq+SEsgytDOWFCGPzucCzISSiLQ=";
17
18 # XXX: hack to make the ar archive go to the correct place
19 # This is necessary because passing `-o ...` to `ldflags` does not work
20 # (this doesn't get communicated everywhere in the chain, apparently, so
21 # `go` complains that it can't find an `a.out` file).
22 GOBIN = "${placeholder "out"}/lib";
23
24 subPackages = [ "." ];
25 ldflags = [
26 "-s"
27 "-w"
28 "-buildmode=c-archive"
29 ];
30 tags = [ "daita" ];
31
32 postInstall = ''
33 mv $out/lib/libwg{,.a}
34 '';
35
36 meta = with lib; {
37 description = "Tiny wrapper around wireguard-go";
38 homepage = "https://github.com/mullvad/mullvadvpn-app/tree/main/wireguard-go-rs/libwg";
39 license = licenses.gpl3Only;
40 maintainers = with maintainers; [ cole-h ];
41 };
42}