2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchzip, kernel, perl, wireguard-tools, bc }:
|
2016-07-11 16:05:23 +00:00
|
|
|
|
2017-04-22 21:34:38 +00:00
|
|
|
# module requires Linux >= 3.10 https://www.wireguard.io/install/#kernel-requirements
|
2021-01-15 14:45:37 +00:00
|
|
|
assert lib.versionAtLeast kernel.version "3.10";
|
2019-12-27 15:47:29 +00:00
|
|
|
# wireguard upstreamed since 5.6 https://lists.zx2c4.com/pipermail/wireguard/2019-December/004704.html
|
2021-01-15 14:45:37 +00:00
|
|
|
assert lib.versionOlder kernel.version "5.6";
|
2016-08-10 22:25:57 +00:00
|
|
|
|
2019-12-27 15:47:29 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "wireguard";
|
2021-02-23 23:30:49 +00:00
|
|
|
version = "1.0.20210219";
|
2019-12-27 15:47:29 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${version}.tar.xz";
|
2021-02-23 23:30:49 +00:00
|
|
|
sha256 = "sha256-ZYZBnfX8DP0IV3VEBSzg7wnFCnlCzOT6Ql3kFZ0klfQ=";
|
2019-12-27 15:47:29 +00:00
|
|
|
};
|
2016-07-11 16:05:23 +00:00
|
|
|
|
2018-05-18 21:52:41 +00:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-07-13 19:15:11 +00:00
|
|
|
|
2018-05-18 21:52:41 +00:00
|
|
|
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
2017-10-09 03:46:32 +00:00
|
|
|
|
2020-04-25 06:19:26 +00:00
|
|
|
nativeBuildInputs = [ perl bc ] ++ kernel.moduleBuildDependencies;
|
2016-07-13 19:15:11 +00:00
|
|
|
|
2020-04-25 06:19:26 +00:00
|
|
|
preBuild = "cd src";
|
2019-03-15 21:43:28 +00:00
|
|
|
buildFlags = [ "module" ];
|
2020-04-25 06:19:26 +00:00
|
|
|
|
|
|
|
INSTALL_MOD_PATH = placeholder "out";
|
|
|
|
installFlags = [ "DEPMOD=true" ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
# remove this when our kernel comes with native wireguard support
|
|
|
|
# and our tests no longer tests this package
|
|
|
|
inherit (wireguard-tools) tests;
|
|
|
|
};
|
2017-10-09 03:46:32 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-06-14 19:45:15 +00:00
|
|
|
inherit (wireguard-tools.meta) homepage license maintainers;
|
|
|
|
description = "Kernel module for the WireGuard secure network tunnel";
|
2019-12-27 15:47:29 +00:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-linux-compat/refs/";
|
2018-06-14 19:45:15 +00:00
|
|
|
platforms = platforms.linux;
|
2016-07-13 19:15:11 +00:00
|
|
|
};
|
2018-05-18 21:52:41 +00:00
|
|
|
}
|