2022-04-03 18:54:34 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, mullvad
|
2024-01-13 08:15:51 +00:00
|
|
|
, fetchpatch
|
2022-04-03 18:54:34 +00:00
|
|
|
}:
|
|
|
|
buildGoModule {
|
|
|
|
pname = "libwg";
|
|
|
|
|
|
|
|
inherit (mullvad)
|
|
|
|
version
|
|
|
|
src
|
|
|
|
;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
sourceRoot = "${mullvad.src.name}/wireguard/libwg";
|
2022-04-03 18:54:34 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
vendorHash = "sha256-MQ5tVbcwMee6lmPyKSsNBh9jrz4zwx7INf1Cb0GxjHo=";
|
2022-04-03 18:54:34 +00:00
|
|
|
|
|
|
|
# XXX: hack to make the ar archive go to the correct place
|
|
|
|
# This is necessary because passing `-o ...` to `ldflags` does not work
|
|
|
|
# (this doesn't get communicated everywhere in the chain, apparently, so
|
|
|
|
# `go` complains that it can't find an `a.out` file).
|
|
|
|
GOBIN = "${placeholder "out"}/lib";
|
|
|
|
ldflags = [ "-s" "-w" "-buildmode=c-archive" ];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
patches = [
|
|
|
|
# build broken without wintun reference
|
|
|
|
# https://github.com/mullvad/mullvadvpn-app/pull/5621
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/mullvad/mullvadvpn-app/commit/5dff68ac9c8ec26f1a39a7f44e3b684bb0833bf1.patch";
|
|
|
|
hash = "sha256-bUcDVmrrDblK7OJvHqf627vzVwmmvO2EL+sioAnZGbk=";
|
|
|
|
relative = "wireguard/libwg";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
postInstall = ''
|
|
|
|
mv $out/lib/libwg{,.a}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A tiny wrapper around wireguard-go";
|
2024-01-13 08:15:51 +00:00
|
|
|
homepage = "https://github.com/mullvad/mullvadvpn-app/tree/main/wireguard/libwg";
|
2022-04-03 18:54:34 +00:00
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ cole-h ];
|
|
|
|
};
|
|
|
|
}
|