2021-03-15 02:42:37 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-25 12:03:30 +02:00
|
|
|
, fetchzip
|
|
|
|
, nixosTests
|
2021-03-15 02:42:37 +01:00
|
|
|
, iptables
|
2021-03-14 17:05:16 +01:00
|
|
|
, iproute2
|
2021-03-15 02:42:37 +01:00
|
|
|
, makeWrapper
|
|
|
|
, openresolv
|
|
|
|
, procps
|
|
|
|
, wireguard-go
|
2019-07-06 21:14:58 +02:00
|
|
|
}:
|
2018-05-18 23:52:41 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-07-06 21:14:58 +02:00
|
|
|
pname = "wireguard-tools";
|
2021-09-16 09:56:12 +02:00
|
|
|
version = "1.0.20210914";
|
2018-05-18 23:52:41 +02:00
|
|
|
|
2018-05-19 12:08:04 +02:00
|
|
|
src = fetchzip {
|
2019-12-27 16:48:06 +01:00
|
|
|
url = "https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${version}.tar.xz";
|
2021-09-16 09:56:12 +02:00
|
|
|
sha256 = "sha256-eGGkTVdPPTWK6iEyowW11F4ywRhd+0IXJTZCqY3OZws=";
|
2018-05-18 23:52:41 +02:00
|
|
|
};
|
|
|
|
|
2020-03-20 00:51:01 +01:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2019-12-27 16:48:06 +01:00
|
|
|
sourceRoot = "source/src";
|
2018-05-18 23:52:41 +02:00
|
|
|
|
2018-12-29 16:41:04 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2018-05-18 23:52:41 +02:00
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"PREFIX=/"
|
2018-05-22 03:17:09 +02:00
|
|
|
"WITH_BASHCOMPLETION=yes"
|
|
|
|
"WITH_SYSTEMDUNITS=yes"
|
|
|
|
"WITH_WGQUICK=yes"
|
2018-05-18 23:52:41 +02:00
|
|
|
];
|
|
|
|
|
2018-05-22 03:17:09 +02:00
|
|
|
postFixup = ''
|
2018-05-18 23:52:41 +02:00
|
|
|
substituteInPlace $out/lib/systemd/system/wg-quick@.service \
|
|
|
|
--replace /usr/bin $out/bin
|
2021-03-15 02:42:37 +01:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2018-12-29 16:41:04 +01:00
|
|
|
for f in $out/bin/*; do
|
2021-11-23 00:24:48 +01:00
|
|
|
wrapProgram $f --prefix PATH : ${lib.makeBinPath [ procps iproute2 iptables openresolv ]}
|
2018-12-29 16:41:04 +01:00
|
|
|
done
|
2021-03-15 02:42:37 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2018-05-22 03:17:09 +02:00
|
|
|
for f in $out/bin/*; do
|
|
|
|
wrapProgram $f --prefix PATH : ${wireguard-go}/bin
|
|
|
|
done
|
2018-05-18 23:52:41 +02:00
|
|
|
'';
|
|
|
|
|
2020-04-25 12:03:30 +02:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
2020-04-26 14:24:18 +02:00
|
|
|
tests = nixosTests.wireguard;
|
2020-04-25 12:03:30 +02:00
|
|
|
};
|
2019-06-01 22:17:25 +02:00
|
|
|
|
2021-03-15 02:42:37 +01:00
|
|
|
meta = with lib; {
|
2018-05-22 03:17:09 +02:00
|
|
|
description = "Tools for the WireGuard secure network tunnel";
|
2021-08-13 12:53:00 +02:00
|
|
|
longDescription = ''
|
|
|
|
Supplies the main userspace tooling for using and configuring WireGuard tunnels, including the wg(8) and wg-quick(8) utilities.
|
|
|
|
- wg : the configuration utility for getting and setting the configuration of WireGuard tunnel interfaces. The interfaces
|
|
|
|
themselves can be added and removed using ip-link(8) and their IP addresses and routing tables can be set using ip-address(8)
|
|
|
|
and ip-route(8). The wg utility provides a series of sub-commands for changing WireGuard-specific aspects of WireGuard interfaces.
|
|
|
|
- wg-quick : an extremely simple script for easily bringing up a WireGuard interface, suitable for a few common use cases.
|
|
|
|
'';
|
2019-12-27 16:48:06 +01:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-tools/refs/";
|
2019-07-06 21:14:58 +02:00
|
|
|
homepage = "https://www.wireguard.com/";
|
2018-05-22 03:17:09 +02:00
|
|
|
license = licenses.gpl2;
|
2021-11-23 13:48:11 +01:00
|
|
|
maintainers = with maintainers; [ elseym ericsagnes zx2c4 globin ma27 d-xo ];
|
2018-05-22 03:17:09 +02:00
|
|
|
platforms = platforms.unix;
|
2018-05-18 23:52:41 +02:00
|
|
|
};
|
|
|
|
}
|