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