1{ stdenv, lib, fetchurl, autoreconfHook, xz, zlib, pkgconfig, libxslt }:
2
3let
4 systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ];
5 modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems;
6
7in stdenv.mkDerivation rec {
8 name = "kmod-${version}";
9 version = "23";
10
11 src = fetchurl {
12 url = "mirror://kernel/linux/utils/kernel/kmod/${name}.tar.xz";
13 sha256 = "0mc12sx06p8il1ym3hdmgxxb37apn9yv7xij26gddjdfkx8xa0yk";
14 };
15
16 nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ];
17 buildInputs = [ xz /* zlib */ ];
18
19 configureFlags = [
20 "--sysconfdir=/etc"
21 "--with-xz"
22 "--with-modulesdirs=${modulesDirs}"
23 # "--with-zlib"
24 ];
25
26 patches = [ ./module-dir.patch ];
27
28 postInstall = ''
29 for prog in rmmod insmod lsmod modinfo modprobe depmod; do
30 ln -sv $out/bin/kmod $out/bin/$prog
31 done
32
33 # Backwards compatibility
34 ln -s bin $out/sbin
35 '';
36
37 meta = {
38 homepage = http://www.kernel.org/pub/linux/utils/kernel/kmod/;
39 description = "Tools for loading and managing Linux kernel modules";
40 platforms = stdenv.lib.platforms.linux;
41 };
42}