Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 60 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 kmod, 6 kernel, 7}: 8 9let 10 modDestDir = "$(out)/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/ethernet/motorcomm"; 11 12in 13stdenv.mkDerivation (finalAttrs: { 14 pname = "yt6801"; 15 version = "1.0.29-20240812"; 16 17 src = 18 let 19 version-split = lib.strings.splitString "-" finalAttrs.version; 20 versionName = builtins.elemAt version-split 0; 21 uploadDate = builtins.elemAt version-split 1; 22 in 23 fetchzip { 24 stripRoot = false; 25 url = "https://www.motor-comm.com/Public/Uploads/uploadfile/files/${uploadDate}/yt6801-linux-driver-${versionName}.zip"; 26 sha256 = "sha256-oz6CeOUN6QWKXxe3WUZljhGDTFArsknjzBuQ4IchGeU="; 27 }; 28 29 nativeBuildInputs = kernel.moduleBuildDependencies ++ [ kmod ]; 30 31 patches = lib.optionals (lib.versionAtLeast kernel.version "6.15") [ 32 ./kernel_6.15_fix.patch 33 ]; 34 35 postPatch = '' 36 substituteInPlace src/Makefile \ 37 --replace-fail "sudo ls -l" "ls -l" \ 38 --replace-fail 'depmod $(shell uname -r)' "" \ 39 --replace-fail 'modprobe $(KFILE)' "" 40 ''; 41 42 makeFlags = [ 43 "KERNELRELEASE=${kernel.modDirVersion}" 44 "KSRC_BASE=" 45 "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" 46 "KDST=kernel/drivers/net/ethernet/motorcomm" 47 "INSTALL_MOD_PATH=${placeholder "out"}" 48 "ko_dir=${modDestDir}" 49 "ko_full=${modDestDir}/yt6801.ko.xz" 50 ]; 51 52 meta = { 53 homepage = "https://www.motor-comm.com/product/ethernet-control-chip"; 54 description = "YT6801 Gigabit PCIe Ethernet controller chip"; 55 license = lib.licenses.gpl2Plus; 56 maintainers = with lib.maintainers; [ indexyz ]; 57 platforms = lib.platforms.linux; 58 sourceProvenance = with lib.sourceTypes; [ fromSource ]; 59 }; 60})