2019-12-27 16:47:29 +01:00
|
|
|
{ stdenv, fetchzip, kernel, perl, wireguard-tools }:
|
2016-07-11 18:05:23 +02:00
|
|
|
|
2017-04-22 23:34:38 +02:00
|
|
|
# module requires Linux >= 3.10 https://www.wireguard.io/install/#kernel-requirements
|
2018-05-18 23:52:41 +02:00
|
|
|
assert stdenv.lib.versionAtLeast kernel.version "3.10";
|
2019-12-27 16:47:29 +01:00
|
|
|
# wireguard upstreamed since 5.6 https://lists.zx2c4.com/pipermail/wireguard/2019-December/004704.html
|
|
|
|
assert stdenv.lib.versionOlder kernel.version "5.6";
|
2016-08-11 00:25:57 +02:00
|
|
|
|
2019-12-27 16:47:29 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "wireguard";
|
2020-01-06 14:56:04 +01:00
|
|
|
version = "0.0.20200105";
|
2019-12-27 16:47:29 +01:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${version}.tar.xz";
|
2020-01-06 14:56:04 +01:00
|
|
|
sha256 = "1b0amq4xjnl0bfxy6g0awbgnfymx3knd4ldai25z53j8f7d9xri7";
|
2019-12-27 16:47:29 +01:00
|
|
|
};
|
2016-07-11 18:05:23 +02:00
|
|
|
|
2018-05-18 23:52:41 +02:00
|
|
|
preConfigure = ''
|
|
|
|
cd src
|
|
|
|
sed -i '/depmod/,+1d' Makefile
|
|
|
|
'';
|
2016-07-13 21:15:11 +02:00
|
|
|
|
2018-05-18 23:52:41 +02:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-07-13 21:15:11 +02:00
|
|
|
|
2018-05-18 23:52:41 +02:00
|
|
|
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
INSTALL_MOD_PATH = "\${out}";
|
2016-07-13 21:15:11 +02:00
|
|
|
|
2018-05-18 23:52:41 +02:00
|
|
|
NIX_CFLAGS = ["-Wno-error=cpp"];
|
2017-10-09 05:46:32 +02:00
|
|
|
|
2018-11-22 14:39:14 +01:00
|
|
|
nativeBuildInputs = [ perl ] ++ kernel.moduleBuildDependencies;
|
2016-07-13 21:15:11 +02:00
|
|
|
|
2019-03-15 22:43:28 +01:00
|
|
|
buildFlags = [ "module" ];
|
|
|
|
installTargets = [ "module-install" ];
|
2017-10-09 05:46:32 +02:00
|
|
|
|
2018-05-18 23:52:41 +02:00
|
|
|
meta = with stdenv.lib; {
|
2018-06-14 21:45:15 +02:00
|
|
|
inherit (wireguard-tools.meta) homepage license maintainers;
|
|
|
|
description = "Kernel module for the WireGuard secure network tunnel";
|
2019-12-27 16:47:29 +01:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-linux-compat/refs/";
|
2018-06-14 21:45:15 +02:00
|
|
|
platforms = platforms.linux;
|
2016-07-13 21:15:11 +02:00
|
|
|
};
|
2018-05-18 23:52:41 +02:00
|
|
|
}
|