From 2287c5f6a55c3c4edf1d244c7dbf7b331aa94783 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sun, 20 May 2018 22:43:35 +0000 Subject: [PATCH] dpdk: extract from linuxPackages.dpdk DPDK kernel modules are optional and its libraries do not reference them. This allows to move the packages that depend on DPDK out of linuxPackages, since they do not depend on kernel version. --- pkgs/os-specific/linux/dpdk/default.nix | 50 ++++++++++++++++--------- pkgs/top-level/all-packages.nix | 4 ++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index fd45e83c26b5..808feaff02cf 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -1,7 +1,13 @@ -{ stdenv, kernel, fetchurl, pkgconfig, numactl }: +{ stdenv, lib, kernel, fetchurl, pkgconfig, numactl }: -stdenv.mkDerivation rec { - name = "dpdk-${version}-${kernel.version}"; +let + + kver = kernel.modDirVersion or null; + + mod = kernel != null; + +in stdenv.mkDerivation rec { + name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}"; version = "17.11.2"; src = fetchurl { @@ -9,35 +15,45 @@ stdenv.mkDerivation rec { sha256 = "19m5l3jkrns8r1zbjb6ry18w50ff36kbl5b5g6pfcp9p57sfisd2"; }; - nativeBuildInputs = [ pkgconfig ] ++ kernel.moduleBuildDependencies; - buildInputs = [ numactl ]; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies; - RTE_KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; + RTE_KERNELDIR = if mod then "${kernel.dev}/lib/modules/${kver}/build" else "/var/empty"; RTE_TARGET = "x86_64-native-linuxapp-gcc"; # we need sse3 instructions to build NIX_CFLAGS_COMPILE = [ "-msse3" ]; - - enableParallelBuilding = true; - outputs = [ "out" "kmod" ]; - hardeningDisable = [ "pic" ]; + postPatch = lib.optionalString (!mod) '' + # Do not build kernel modules. + cat >>config/defconfig_$RTE_TARGET <