2018-11-22 13:39:14 +00:00
|
|
|
{ stdenv, kernel, wireguard-tools, perl }:
|
2016-07-11 17:05:23 +01:00
|
|
|
|
2017-04-22 22:34:38 +01:00
|
|
|
# module requires Linux >= 3.10 https://www.wireguard.io/install/#kernel-requirements
|
2018-05-18 22:52:41 +01:00
|
|
|
assert stdenv.lib.versionAtLeast kernel.version "3.10";
|
2016-08-10 23:25:57 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2016-12-14 21:09:35 +00:00
|
|
|
name = "wireguard-${version}";
|
2018-05-22 01:52:47 +01:00
|
|
|
inherit (wireguard-tools) src version;
|
2016-07-11 17:05:23 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
preConfigure = ''
|
|
|
|
cd src
|
|
|
|
sed -i '/depmod/,+1d' Makefile
|
|
|
|
'';
|
2016-07-13 20:15:11 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-07-13 20:15:11 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
INSTALL_MOD_PATH = "\${out}";
|
2016-07-13 20:15:11 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
NIX_CFLAGS = ["-Wno-error=cpp"];
|
2017-10-09 04:46:32 +01:00
|
|
|
|
2018-11-22 13:39:14 +00:00
|
|
|
nativeBuildInputs = [ perl ] ++ kernel.moduleBuildDependencies;
|
2016-07-13 20:15:11 +01:00
|
|
|
|
2019-03-15 21:43:28 +00:00
|
|
|
buildFlags = [ "module" ];
|
|
|
|
installTargets = [ "module-install" ];
|
2017-10-09 04:46:32 +01:00
|
|
|
|
2018-05-18 22:52:41 +01:00
|
|
|
meta = with stdenv.lib; {
|
2018-06-14 20:45:15 +01:00
|
|
|
inherit (wireguard-tools.meta) homepage license maintainers;
|
|
|
|
description = "Kernel module for the WireGuard secure network tunnel";
|
|
|
|
platforms = platforms.linux;
|
2016-07-13 20:15:11 +01:00
|
|
|
};
|
2018-05-18 22:52:41 +01:00
|
|
|
}
|