2020-04-25 11:03:30 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchzip
|
|
|
|
, nixosTests
|
|
|
|
, iptables ? null
|
|
|
|
, iproute ? null
|
|
|
|
, makeWrapper ? null
|
|
|
|
, openresolv ? null
|
|
|
|
, procps ? null
|
|
|
|
, wireguard-go ? null
|
2019-07-06 20:14:58 +01:00
|
|
|
}:
|
2018-05-18 22:52:41 +01:00
|
|
|
|
2018-05-22 02:17:09 +01:00
|
|
|
with stdenv.lib;
|
2018-05-18 22:52:41 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-07-06 20:14:58 +01:00
|
|
|
pname = "wireguard-tools";
|
2020-03-19 23:51:01 +00:00
|
|
|
version = "1.0.20200319";
|
2018-05-18 22:52:41 +01:00
|
|
|
|
2018-05-19 11:08:04 +01:00
|
|
|
src = fetchzip {
|
2019-12-27 15:48:06 +00:00
|
|
|
url = "https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${version}.tar.xz";
|
2020-03-19 23:51:01 +00:00
|
|
|
sha256 = "0g9vlngg9dnh7qqfhaycw35fq8ij5hfz6p1cykh4ncjgr93i7rbx";
|
2018-05-18 22:52:41 +01:00
|
|
|
};
|
|
|
|
|
2020-03-19 23:51:01 +00:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2019-12-27 15:48:06 +00:00
|
|
|
sourceRoot = "source/src";
|
2018-05-18 22:52:41 +01:00
|
|
|
|
2018-12-29 15:41:04 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2018-05-18 22:52:41 +01:00
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"PREFIX=/"
|
2018-05-22 02:17:09 +01:00
|
|
|
"WITH_BASHCOMPLETION=yes"
|
|
|
|
"WITH_SYSTEMDUNITS=yes"
|
|
|
|
"WITH_WGQUICK=yes"
|
2018-05-18 22:52:41 +01:00
|
|
|
];
|
|
|
|
|
2018-05-22 02:17:09 +01:00
|
|
|
postFixup = ''
|
2018-05-18 22:52:41 +01:00
|
|
|
substituteInPlace $out/lib/systemd/system/wg-quick@.service \
|
|
|
|
--replace /usr/bin $out/bin
|
2018-12-29 15:41:04 +00:00
|
|
|
'' + optionalString stdenv.isLinux ''
|
|
|
|
for f in $out/bin/*; do
|
2019-11-27 23:19:38 +00:00
|
|
|
wrapProgram $f --prefix PATH : ${makeBinPath [procps iproute iptables openresolv]}
|
2018-12-29 15:41:04 +00:00
|
|
|
done
|
2018-05-22 02:17:09 +01:00
|
|
|
'' + optionalString stdenv.isDarwin ''
|
|
|
|
for f in $out/bin/*; do
|
|
|
|
wrapProgram $f --prefix PATH : ${wireguard-go}/bin
|
|
|
|
done
|
2018-05-18 22:52:41 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-25 11:03:30 +01:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
tests = {
|
2020-04-25 19:22:14 +01:00
|
|
|
inherit (nixosTests) wireguard wg-quick wireguard-generated wireguard-namespaces;
|
2020-04-25 11:03:30 +01:00
|
|
|
};
|
|
|
|
};
|
2019-06-01 21:17:25 +01:00
|
|
|
|
2019-07-06 20:14:58 +01:00
|
|
|
meta = {
|
2018-05-22 02:17:09 +01:00
|
|
|
description = "Tools for the WireGuard secure network tunnel";
|
2019-12-27 15:48:06 +00:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-tools/refs/";
|
2019-07-06 20:14:58 +01:00
|
|
|
homepage = "https://www.wireguard.com/";
|
2018-05-22 02:17:09 +01:00
|
|
|
license = licenses.gpl2;
|
2019-12-27 15:48:06 +00:00
|
|
|
maintainers = with maintainers; [ elseym ericsagnes mic92 zx2c4 globin ma27 xwvvvvwx ];
|
2018-05-22 02:17:09 +01:00
|
|
|
platforms = platforms.unix;
|
2018-05-18 22:52:41 +01:00
|
|
|
};
|
|
|
|
}
|