at 23.11-beta 49 lines 1.6 kB view raw
1{ lib, stdenv, fetchzip, kernel, perl, wireguard-tools, bc }: 2 3# wireguard upstreamed since 5.6 https://lists.zx2c4.com/pipermail/wireguard/2019-December/004704.html 4assert lib.versionOlder kernel.version "5.6"; 5 6stdenv.mkDerivation rec { 7 pname = "wireguard"; 8 version = "1.0.20220627"; 9 10 src = fetchzip { 11 url = "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${version}.tar.xz"; 12 sha256 = "sha256-skbho3e49lZ/GLp/JDQpf/yXIEjes86aYtw/dn6e0Uo="; 13 }; 14 15 hardeningDisable = [ "pic" ]; 16 17 KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; 18 19 nativeBuildInputs = [ perl bc ] ++ kernel.moduleBuildDependencies; 20 21 preBuild = "cd src"; 22 buildFlags = [ "module" ]; 23 makeFlags = [ 24 "ARCH=${stdenv.hostPlatform.linuxArch}" 25 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 26 "CROSS_COMPILE=${stdenv.cc.targetPrefix}" 27 ]; 28 29 INSTALL_MOD_PATH = placeholder "out"; 30 installFlags = [ "DEPMOD=true" ]; 31 enableParallelBuilding = true; 32 33 passthru = { 34 # remove this when our kernel comes with native wireguard support 35 # and our tests no longer tests this package 36 inherit (wireguard-tools) tests; 37 }; 38 39 meta = with lib; { 40 inherit (wireguard-tools.meta) homepage license maintainers; 41 description = "Kernel module for the WireGuard secure network tunnel"; 42 longDescription = '' 43 Backport of WireGuard for kernels 3.10 to 5.5, as an out of tree module. 44 (as WireGuard was merged into the Linux kernel for 5.6) 45 ''; 46 downloadPage = "https://git.zx2c4.com/wireguard-linux-compat/refs/"; 47 platforms = platforms.linux; 48 }; 49}