Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 65 lines 1.9 kB view raw
1{ 2 kernel, 3 stdenv, 4 kmod, 5 lib, 6 fetchzip, 7 dos2unix, 8}: 9 10stdenv.mkDerivation { 11 pname = "ax99100"; 12 version = "1.8.0"; 13 14 nativeBuildInputs = [ 15 dos2unix 16 kmod 17 ] 18 ++ kernel.moduleBuildDependencies; 19 20 src = fetchzip { 21 url = "https://www.asix.com.tw/en/support/download/file/1229"; 22 sha256 = "1rbp1m01qr6b3nbr72vpbw89pjh8mddc60im78z2yjd951xkbcjh"; 23 extension = "tar.bz2"; 24 }; 25 26 prePatch = '' 27 # The sources come with Windows file endings and that makes 28 # applying patches hard without first fixing the line endings. 29 dos2unix *.c *.h 30 ''; 31 32 # The patches are adapted from: https://aur.archlinux.org/packages/asix-ax99100 33 # 34 # We included them here instead of fetching them, because of line 35 # ending issues that are easier to fix manually. Also the 36 # set_termios patch needs to be applied for 6.1 not for 6.0. 37 patches = [ 38 ./kernel-5.18-pci_free_consistent-pci_alloc_consistent.patch 39 ./kernel-6.1-set_termios-const-ktermios.patch 40 ] 41 ++ lib.optionals (lib.versionAtLeast kernel.version "6.2") [ 42 ./kernel-6.2-fix-pointer-type.patch 43 ./kernel-6.4-fix-define-semaphore.patch 44 ]; 45 46 patchFlags = [ "-p0" ]; 47 48 makeFlags = [ "KDIR='${kernel.dev}/lib/modules/${kernel.modDirVersion}/build'" ]; 49 50 installPhase = '' 51 mkdir -p $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/tty/serial 52 cp ax99100.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/tty/serial 53 ''; 54 55 meta = { 56 description = "ASIX AX99100 Serial and Parallel Port driver"; 57 homepage = "https://www.asix.com.tw/en/product/Interface/PCIe_Bridge/AX99100"; 58 # According to the source code in the tarball, the license is gpl2. 59 license = lib.licenses.gpl2Plus; 60 platforms = lib.platforms.linux; 61 62 # Older Linux versions need more patches to work. 63 broken = lib.versionOlder kernel.version "5.4.0"; 64 }; 65}