nixpkgs/pkgs/os-specific/linux/ena/default.nix
Artturin f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00

48 lines
1.2 KiB
Nix

{ lib, stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
version = "2.8.3";
name = "ena-${version}-${kernel.version}";
src = fetchFromGitHub {
owner = "amzn";
repo = "amzn-drivers";
rev = "ena_linux_${version}";
sha256 = "sha256-Z5BCqqC4FNKHqpocJ6CsHwhh5sszj5QfxiN6+Dkaqek=";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags;
# linux 3.12
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
configurePhase = ''
runHook preConfigure
cd kernel/linux/ena
export ENA_PHC_INCLUDE=1
substituteInPlace Makefile --replace '/lib/modules/$(BUILD_KERNEL)' ${kernel.dev}/lib/modules/${kernel.modDirVersion}
runHook postConfigure
'';
installPhase = ''
runHook preInstall
$STRIP -S ena.ko
dest=$out/lib/modules/${kernel.modDirVersion}/misc
mkdir -p $dest
cp ena.ko $dest/
xz $dest/ena.ko
runHook postInstall
'';
meta = with lib; {
description = "Amazon Elastic Network Adapter (ENA) driver for Linux";
homepage = "https://github.com/amzn/amzn-drivers";
license = licenses.gpl2Only;
maintainers = with maintainers; [ eelco sielicki ];
platforms = platforms.linux;
};
}