2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchzip, kernel, perl, wireguard-tools, bc }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# wireguard upstreamed since 5.6 https://lists.zx2c4.com/pipermail/wireguard/2019-December/004704.html
|
2021-02-05 17:12:51 +00:00
|
|
|
assert lib.versionOlder kernel.version "5.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "wireguard";
|
2022-11-02 22:02:43 +00:00
|
|
|
version = "1.0.20220627";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${version}.tar.xz";
|
2022-11-02 22:02:43 +00:00
|
|
|
sha256 = "sha256-skbho3e49lZ/GLp/JDQpf/yXIEjes86aYtw/dn6e0Uo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
nativeBuildInputs = [ perl bc ] ++ kernel.moduleBuildDependencies;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
preBuild = "cd src";
|
2020-04-24 23:36:52 +00:00
|
|
|
buildFlags = [ "module" ];
|
2022-11-02 22:02:43 +00:00
|
|
|
makeFlags = [
|
|
|
|
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
|
|
|
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
|
|
];
|
2020-05-03 17:38:23 +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;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (wireguard-tools.meta) homepage license maintainers;
|
|
|
|
description = "Kernel module for the WireGuard secure network tunnel";
|
2021-08-25 08:27:29 +00:00
|
|
|
longDescription = ''
|
|
|
|
Backport of WireGuard for kernels 3.10 to 5.5, as an out of tree module.
|
|
|
|
(as WireGuard was merged into the Linux kernel for 5.6)
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
downloadPage = "https://git.zx2c4.com/wireguard-linux-compat/refs/";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|