at 23.05-pre 81 lines 2.9 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 = "30"; 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 sha256 = "sha256-/dih2LoqgRrAsVdHRwld28T8pXgqnzapnQhqkXnxbbc="; 25 }; 26 27 outputs = [ "out" "dev" "lib" ] ++ lib.optional withDevdoc "devdoc"; 28 29 nativeBuildInputs = [ 30 autoconf automake docbook_xsl libtool libxslt pkg-config 31 32 docbook_xml_dtd_42 # for the man pages 33 ] ++ lib.optionals withDevdoc [ docbook_xml_dtd_43 gtk-doc ]; 34 buildInputs = [ xz zstd ]; 35 36 preConfigure = '' 37 ./autogen.sh 38 ''; 39 40 configureFlags = [ 41 "--sysconfdir=/etc" 42 "--with-xz" 43 "--with-zstd" 44 "--with-modulesdirs=${modulesDirs}" 45 (lib.enableFeature withDevdoc "gtk-doc") 46 ] ++ lib.optional withStatic "--enable-static"; 47 48 patches = [ ./module-dir.patch ] 49 ++ lib.optional withStatic ./enable-static.patch; 50 51 postInstall = '' 52 for prog in rmmod insmod lsmod modinfo modprobe depmod; do 53 ln -sv $out/bin/kmod $out/bin/$prog 54 done 55 56 # Backwards compatibility 57 ln -s bin $out/sbin 58 ''; 59 60 passthru.updateScript = gitUpdater { 61 # No nicer place to find latest release. 62 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git"; 63 rev-prefix = "v"; 64 }; 65 66 meta = with lib; { 67 description = "Tools for loading and managing Linux kernel modules"; 68 longDescription = '' 69 kmod is a set of tools to handle common tasks with Linux kernel modules 70 like insert, remove, list, check properties, resolve dependencies and 71 aliases. These tools are designed on top of libkmod, a library that is 72 shipped with kmod. 73 ''; 74 homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/"; 75 downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/"; 76 changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}"; 77 license = with licenses; [ lgpl21Plus gpl2Plus ]; # GPLv2+ for tools 78 platforms = platforms.linux; 79 maintainers = with maintainers; [ artturin ]; 80 }; 81}