2016-08-14 02:53:52 -07:00
|
|
|
{ stdenv, lib, fetchurl, autoreconfHook, xz, zlib, pkgconfig, libxslt }:
|
2012-03-25 13:05:36 -07:00
|
|
|
|
2016-08-14 02:53:52 -07:00
|
|
|
let
|
2016-08-14 02:53:52 -07:00
|
|
|
systems = [ "current-system" "booted-system" ];
|
|
|
|
modulesDirs = lib.concatMapStringsSep ":" (x: "/run/${x}/kernel-modules/lib/modules") systems;
|
2016-08-14 02:53:52 -07:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "kmod-${version}";
|
2016-08-14 02:53:52 -07:00
|
|
|
version = "22";
|
2012-03-25 13:05:36 -07:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-06-15 10:58:42 -07:00
|
|
|
url = "mirror://kernel/linux/utils/kernel/kmod/${name}.tar.xz";
|
2016-08-15 16:42:03 -07:00
|
|
|
sha256 = "0mc12sx06p8il1ym3hdmgxxb37apn9yv7xij26gddjdfkx8xa0yk";
|
2012-03-25 13:05:36 -07:00
|
|
|
};
|
|
|
|
|
2016-08-14 02:53:52 -07:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ];
|
|
|
|
buildInputs = [ xz /* zlib */ ];
|
2012-03-25 13:05:36 -07:00
|
|
|
|
2016-08-14 02:53:52 -07:00
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--with-xz"
|
|
|
|
"--with-modulesdirs=${modulesDirs}"
|
|
|
|
# "--with-zlib"
|
|
|
|
];
|
2012-03-25 13:05:36 -07:00
|
|
|
|
2012-04-04 12:24:07 -07:00
|
|
|
patches = [ ./module-dir.patch ];
|
|
|
|
|
2012-04-04 12:28:33 -07:00
|
|
|
postInstall = ''
|
2016-08-14 02:53:52 -07:00
|
|
|
for prog in rmmod insmod lsmod modinfo modprobe depmod; do
|
|
|
|
ln -sv $out/bin/kmod $out/bin/$prog
|
2012-04-04 12:28:33 -07:00
|
|
|
done
|
2016-08-14 02:53:52 -07:00
|
|
|
|
|
|
|
# Backwards compatibility
|
|
|
|
ln -s bin $out/sbin
|
2012-04-04 12:28:33 -07:00
|
|
|
'';
|
|
|
|
|
2012-03-25 13:05:36 -07:00
|
|
|
meta = {
|
|
|
|
homepage = http://www.kernel.org/pub/linux/utils/kernel/kmod/;
|
|
|
|
description = "Tools for loading and managing Linux kernel modules";
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|