intel-npu-driver: init at 1.19.0

Only support the standalone build.

Closes: #348739
This commit is contained in:
Atlas Yu
2025-02-26 11:00:34 +08:00
parent a94dd3a654
commit 1943dbfcca
4 changed files with 118 additions and 0 deletions
+6
View File
@@ -20468,6 +20468,12 @@
matrix = "@pschmitt:one.ems.host";
keys = [ { fingerprint = "9FBF 2ABF FB37 F7F3 F502 44E5 DC43 9C47 EACB 17F9"; } ];
};
pseudocc = {
email = "pseudoc@163.com";
github = "pseudocc";
githubId = 85104110;
name = "Atlas Yu";
};
pshirshov = {
email = "pshirshov@eml.cc";
github = "pshirshov";
+32
View File
@@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.hardware.cpu.intel.npu;
in
{
options = {
hardware.cpu.intel.npu = {
enable = lib.mkEnableOption "Intel NPU support";
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = config.hardware.graphics.enable;
message = "Intel NPU requires hardware.graphics.enable to be enabled";
}
];
hardware.firmware = [ pkgs.intel-npu-driver.firmware ];
hardware.graphics.extraPackages = [ pkgs.intel-npu-driver ];
environment.systemPackages = [
pkgs.intel-npu-driver.validation
pkgs.level-zero
];
};
}
@@ -220,6 +220,11 @@ sub pciCheck {
($device eq "0x4229" || $device eq "0x4230" ||
$device eq "0x4222" || $device eq "0x4227");
push @attrs, "hardware.cpu.intel.npu.enable = true;" if
$vendor eq "0x8086" &&
($device eq "0x7d1d" || $device eq "0xad1d" ||
$device eq "0x643e" || $device eq "0xb03e");
# Assume that all NVIDIA cards are supported by the NVIDIA driver.
# There may be exceptions (e.g. old cards).
# FIXME: do we want to enable an unfree driver here?
@@ -0,0 +1,75 @@
{
lib,
stdenv,
udev,
openssl,
boost,
cmake,
git,
level-zero,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
pname = "intel-npu-driver";
version = "1.19.0";
src = fetchFromGitHub {
owner = "intel";
repo = "linux-npu-driver";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-TQfqBSSHHPck0srnezqcXPHaIIC3SymvwaYU6svI13c=";
};
buildInputs = [
udev
openssl
boost
level-zero
];
nativeBuildInputs = [
cmake
];
outputs = [
"out"
"validation"
"firmware"
];
postPatch = ''
rm -rf third_party/level-zero
rm third_party/cmake/level-zero.cmake
rm third_party/cmake/FindLevelZero.cmake
substituteInPlace third_party/CMakeLists.txt --replace-fail \
"include(cmake/level-zero.cmake)" \
""
substituteInPlace third_party/level-zero-npu-extensions/ze_graph_ext.h --replace-fail \
"#include \"ze_api.h\"" \
"#include <level_zero/ze_api.h>"
substituteInPlace validation/{kmd-test,umd-test}/CMakeLists.txt --replace-fail \
"COMPONENT validation-npu" \
"DESTINATION $validation/bin COMPONENT validation-npu"
substituteInPlace firmware/CMakeLists.txt --replace-fail \
"DESTINATION /lib/firmware/updates/intel/vpu/" \
"DESTINATION $firmware/lib/firmware/intel/vpu/"
'';
installPhase = ''
cmake --install . --component level-zero-npu
cmake --install . --component validation-npu
cmake --install . --component fw-npu
'';
meta = {
homepage = "https://github.com/intel/linux-npu-driver";
description = "Intel NPU (Neural Processing Unit) Standalone Driver";
platforms = [ "x86_64-linux" ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pseudocc ];
};
}