1 { stdenv, lib, fetchzip, fetchpatch, 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
10 systems = [ "/run/booted-system/kernel-modules" "/run/current-system/kernel-modules" "" ];
11 modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems;
13 in stdenv.mkDerivation rec {
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
23 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/snapshot/kmod-${version}.tar.gz";
24 hash = "sha256-FNR015/AoYBbi7Eb1M2TXH3yxUuddKICCu+ot10CdeQ=";
27 outputs = [ "out" "dev" "lib" ] ++ lib.optional withDevdoc "devdoc";
31 autoconf automake docbook_xsl libtool libxslt pkg-config
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 ];
47 "--with-modulesdirs=${modulesDirs}"
48 (lib.enableFeature withDevdoc "gtk-doc")
49 ] ++ lib.optional withStatic "--enable-static";
55 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/patch/?id=11eb9bc67c319900ab00523997323a97d2d08ad2";
56 hash = "sha256-CYG615elMWces6QGQRg2H/NL7W4XsG9Zvz5H+xsdFFo=";
58 ] ++ lib.optional withStatic ./enable-static.patch;
61 for prog in rmmod insmod lsmod modinfo modprobe depmod; do
62 ln -sv $out/bin/kmod $out/bin/$prog
65 # Backwards compatibility
69 passthru.updateScript = gitUpdater {
70 # No nicer place to find latest release.
71 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git";
76 description = "Tools for loading and managing Linux kernel modules";
78 kmod is a set of tools to handle common tasks with Linux kernel modules
79 like insert, remove, list, check properties, resolve dependencies and
80 aliases. These tools are designed on top of libkmod, a library that is
83 homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/";
84 downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/";
85 changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}";
86 license = with licenses; [ lgpl21Plus gpl2Plus ]; # GPLv2+ for tools
87 platforms = platforms.linux;
88 maintainers = with maintainers; [ artturin ];