at 25.11-pre 130 lines 3.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchzip, 5 fetchpatch, 6 autoconf, 7 automake, 8 docbook_xml_dtd_42, 9 docbook_xml_dtd_43, 10 docbook_xsl, 11 gtk-doc, 12 libtool, 13 pkg-config, 14 libxslt, 15 xz, 16 zstd, 17 elf-header, 18 withDevdoc ? stdenv.hostPlatform == stdenv.buildPlatform, 19 withStatic ? stdenv.hostPlatform.isStatic, 20 gitUpdater, 21}: 22 23let 24 systems = [ 25 "/run/booted-system/kernel-modules" 26 "/run/current-system/kernel-modules" 27 "" 28 ]; 29 modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems; 30 31in 32stdenv.mkDerivation rec { 33 pname = "kmod"; 34 version = "31"; 35 36 # autogen.sh is missing from the release tarball, 37 # and we need to run it to regenerate gtk_doc.make, 38 # because the version in the release tarball is broken. 39 # Possibly this will be fixed in kmod 30? 40 # https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/.gitignore?id=61a93a043aa52ad62a11ba940d4ba93cb3254e78 41 src = fetchzip { 42 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/snapshot/kmod-${version}.tar.gz"; 43 hash = "sha256-FNR015/AoYBbi7Eb1M2TXH3yxUuddKICCu+ot10CdeQ="; 44 }; 45 46 outputs = [ 47 "out" 48 "dev" 49 "lib" 50 ] ++ lib.optional withDevdoc "devdoc"; 51 52 strictDeps = true; 53 nativeBuildInputs = 54 [ 55 autoconf 56 automake 57 docbook_xsl 58 libtool 59 libxslt 60 pkg-config 61 62 docbook_xml_dtd_42 # for the man pages 63 ] 64 ++ lib.optionals withDevdoc [ 65 docbook_xml_dtd_43 66 gtk-doc 67 ]; 68 buildInputs = 69 [ 70 xz 71 zstd 72 ] 73 # gtk-doc is looked for with pkg-config 74 ++ lib.optionals withDevdoc [ gtk-doc ]; 75 76 preConfigure = '' 77 ./autogen.sh 78 ''; 79 80 configureFlags = [ 81 "--sysconfdir=/etc" 82 "--with-xz" 83 "--with-zstd" 84 "--with-modulesdirs=${modulesDirs}" 85 (lib.enableFeature withDevdoc "gtk-doc") 86 ] ++ lib.optional withStatic "--enable-static"; 87 88 patches = [ 89 ./module-dir.patch 90 (fetchpatch { 91 name = "musl.patch"; 92 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/patch/?id=11eb9bc67c319900ab00523997323a97d2d08ad2"; 93 hash = "sha256-CYG615elMWces6QGQRg2H/NL7W4XsG9Zvz5H+xsdFFo="; 94 }) 95 ] ++ lib.optional withStatic ./enable-static.patch; 96 97 postInstall = '' 98 for prog in rmmod insmod lsmod modinfo modprobe depmod; do 99 ln -sv $out/bin/kmod $out/bin/$prog 100 done 101 102 # Backwards compatibility 103 ln -s bin $out/sbin 104 ''; 105 106 passthru.updateScript = gitUpdater { 107 # No nicer place to find latest release. 108 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git"; 109 rev-prefix = "v"; 110 }; 111 112 meta = with lib; { 113 description = "Tools for loading and managing Linux kernel modules"; 114 longDescription = '' 115 kmod is a set of tools to handle common tasks with Linux kernel modules 116 like insert, remove, list, check properties, resolve dependencies and 117 aliases. These tools are designed on top of libkmod, a library that is 118 shipped with kmod. 119 ''; 120 homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/"; 121 downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/"; 122 changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}"; 123 license = with licenses; [ 124 lgpl21Plus 125 gpl2Plus 126 ]; # GPLv2+ for tools 127 platforms = platforms.linux; 128 maintainers = with maintainers; [ artturin ]; 129 }; 130}