2017-02-07 17:17:28 +00:00
|
|
|
{ stdenv, buildPackages, lib, fetchurl, autoreconfHook, pkgconfig, libxslt, xz }:
|
2012-03-25 20:05:36 +00:00
|
|
|
|
2016-08-14 09:53:52 +00:00
|
|
|
let
|
2016-08-15 23:42:03 +00:00
|
|
|
systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ];
|
|
|
|
modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems;
|
2016-08-14 09:53:52 +00:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "kmod-${version}";
|
2018-01-16 21:33:11 +00:00
|
|
|
version = "25";
|
2012-03-25 20:05:36 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-06-15 17:58:42 +00:00
|
|
|
url = "mirror://kernel/linux/utils/kernel/kmod/${name}.tar.xz";
|
2018-01-16 21:33:11 +00:00
|
|
|
sha256 = "1kgixs4m3jvwk7fb3d18n6j77qhgi9qfv4csj35rs5ancr4ycrbi";
|
2012-03-25 20:05:36 +00:00
|
|
|
};
|
|
|
|
|
2016-08-14 09:53:52 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ];
|
2017-02-07 17:17:28 +00:00
|
|
|
buildInputs = [ xz ];
|
2012-03-25 20:05:36 +00:00
|
|
|
|
2016-08-14 09:53:52 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--with-xz"
|
|
|
|
"--with-modulesdirs=${modulesDirs}"
|
|
|
|
];
|
2012-03-25 20:05:36 +00:00
|
|
|
|
2012-04-04 19:24:07 +00:00
|
|
|
patches = [ ./module-dir.patch ];
|
|
|
|
|
2012-04-04 19:28:33 +00:00
|
|
|
postInstall = ''
|
2016-08-14 09:53:52 +00:00
|
|
|
for prog in rmmod insmod lsmod modinfo modprobe depmod; do
|
|
|
|
ln -sv $out/bin/kmod $out/bin/$prog
|
2012-04-04 19:28:33 +00:00
|
|
|
done
|
2016-08-14 09:53:52 +00:00
|
|
|
|
|
|
|
# Backwards compatibility
|
|
|
|
ln -s bin $out/sbin
|
2012-04-04 19:28:33 +00:00
|
|
|
'';
|
|
|
|
|
2018-08-30 19:28:03 +00:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-02 21:50:51 +00:00
|
|
|
homepage = https://www.kernel.org/pub/linux/utils/kernel/kmod/;
|
2012-03-25 20:05:36 +00:00
|
|
|
description = "Tools for loading and managing Linux kernel modules";
|
2018-08-30 19:28:03 +00:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
platforms = platforms.linux;
|
2012-03-25 20:05:36 +00:00
|
|
|
};
|
|
|
|
}
|