1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6 kernelModuleMakeFlags,
7}:
8stdenv.mkDerivation (finalAttrs: {
9 pname = "tt-kmd";
10 version = "2.3.0";
11
12 src = fetchFromGitHub {
13 owner = "tenstorrent";
14 repo = "tt-kmd";
15 tag = "ttkmd-${finalAttrs.version}";
16 hash = "sha256-o9F6WsiNQGD/0VraBVO2oEwPTc2Yjh3aitvITp/M2+4=";
17 };
18
19 nativeBuildInputs = kernel.moduleBuildDependencies;
20
21 makeFlags = kernelModuleMakeFlags;
22
23 buildFlags = [
24 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
25 ];
26
27 installFlags = finalAttrs.buildFlags ++ [
28 "INSTALL_MOD_PATH=${placeholder "out"}"
29 "INSTALL_MOD_DIR=misc"
30 ];
31
32 installTargets = [ "modules_install" ];
33
34 postInstall = ''
35 mkdir -p $out/lib/udev/rules.d
36 cp udev-50-tenstorrent.rules $out/lib/udev/rules.d/50-tenstorrent.rules
37 '';
38
39 meta = {
40 description = "Tenstorrent Kernel Module";
41 homepage = "https://github.com/tenstorrent/tt-kmd";
42 maintainers = with lib.maintainers; [ RossComputerGuy ];
43 license = with lib.licenses; [ gpl2Only ];
44 platforms = lib.platforms.linux;
45 };
46})