2021-03-19 17:17:44 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-05-03 17:38:23 +00:00
|
|
|
, fetchzip
|
|
|
|
, nixosTests
|
2021-03-19 17:17:44 +00:00
|
|
|
, iptables
|
2021-04-05 15:23:46 +00:00
|
|
|
, iproute2
|
2021-03-19 17:17:44 +00:00
|
|
|
, makeWrapper
|
|
|
|
, openresolv
|
|
|
|
, procps
|
2023-02-16 17:41:37 +00:00
|
|
|
, bash
|
2023-10-19 13:55:26 +00:00
|
|
|
, wireguard-go
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "wireguard-tools";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "1.0.20210914";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${version}.tar.xz";
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-eGGkTVdPPTWK6iEyowW11F4ywRhd+0IXJTZCqY3OZws=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
sourceRoot = "${src.name}/src";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
buildInputs = [ bash ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlags = [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"PREFIX=/"
|
|
|
|
"WITH_BASHCOMPLETION=yes"
|
|
|
|
"WITH_SYSTEMDUNITS=yes"
|
|
|
|
"WITH_WGQUICK=yes"
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace $out/lib/systemd/system/wg-quick@.service \
|
|
|
|
--replace /usr/bin $out/bin
|
2021-03-19 17:17:44 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2020-04-24 23:36:52 +00:00
|
|
|
for f in $out/bin/*; do
|
2023-01-11 07:51:40 +00:00
|
|
|
# Which firewall and resolvconf implementations to use should be determined by the
|
|
|
|
# environment, we provide the "default" ones as fallback.
|
2022-07-14 12:49:19 +00:00
|
|
|
wrapProgram $f \
|
2023-01-11 07:51:40 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ procps iproute2 ]} \
|
|
|
|
--suffix PATH : ${lib.makeBinPath [ iptables openresolv ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
2023-10-19 13:55:26 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
for f in $out/bin/*; do
|
|
|
|
wrapProgram $f \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ wireguard-go ]}
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
2020-05-29 06:06:01 +00:00
|
|
|
tests = nixosTests.wireguard;
|
2020-05-03 17:38:23 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tools for the WireGuard secure network tunnel";
|
2021-08-25 08:27:29 +00: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.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-tools/refs/";
|
|
|
|
homepage = "https://www.wireguard.com/";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = licenses.gpl2Only;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ ericsagnes zx2c4 globin ma27 d-xo ];
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "wg";
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|