depot/third_party/nixpkgs/pkgs/os-specific/linux/mstflint_access/default.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

40 lines
1.2 KiB
Nix

{ lib, stdenv, fetchurl, kernel, kmod, mstflint }:
stdenv.mkDerivation rec {
pname = "mstflint_access";
inherit (mstflint) version;
src = fetchurl {
url = "https://github.com/Mellanox/mstflint/releases/download/v${version}/kernel-mstflint-${version}.tar.gz";
hash = "sha256-rfZts0m8x6clVazpbAa2xK+dYgRU9Us5rbcWa0uHJ1M=";
};
nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KVER=${kernel.modDirVersion}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
enableParallelBuilding = true;
preConfigure = lib.optionals (lib.versionAtLeast kernel.version "6.4") ''
sed -i "s/class_create(THIS_MODULE, dev->name)/class_create(dev->name)/g" mst_main.c
'';
installPhase = ''
runHook preInstall
install -D ${pname}.ko $out/lib/modules/${kernel.modDirVersion}/extra/${pname}.ko
runHook postInstall
'';
meta = with lib; {
description = "A kernel module for Nvidia NIC firmware update";
homepage = "https://github.com/Mellanox/mstflint";
license = [ licenses.gpl2Only ];
maintainers = with maintainers; [ thillux ];
platforms = platforms.linux;
};
}