1{
2 lib,
3 fetchFromGitHub,
4 kernel,
5 kernelModuleMakeFlags,
6 unstableGitUpdater,
7}:
8kernel.stdenv.mkDerivation {
9 pname = "rust-out-of-tree-module";
10 version = "0-unstable-2024-05-06";
11
12 src = fetchFromGitHub {
13 owner = "Rust-for-linux";
14 repo = "rust-out-of-tree-module";
15
16 rev = "9872947486bb8f60b0d11db15d546a3d06156ec5";
17 hash = "sha256-TzCySY7uQac98dU+Nu5dC4Usm7oG0iIdZZmZgAOpni4=";
18 };
19
20 nativeBuildInputs = kernel.moduleBuildDependencies;
21 makeFlags = kernelModuleMakeFlags ++ [
22 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
23 ];
24
25 installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
26 installTargets = [ "modules_install" ];
27
28 passthru.updateScript = unstableGitUpdater { };
29
30 meta = {
31 broken = !kernel.withRust;
32 description = "Basic template for an out-of-tree Linux kernel module written in Rust";
33 homepage = "https://github.com/Rust-for-Linux/rust-out-of-tree-module";
34 license = lib.licenses.gpl2Only;
35 maintainers = [ lib.maintainers.blitz ];
36 platforms = [ "x86_64-linux" ] ++ lib.optional (kernel.kernelAtLeast "6.9") "aarch64-linux";
37 };
38
39}