at 18.03-beta 43 lines 1.2 kB view raw
1{ stdenv, buildPackages, lib, fetchurl, autoreconfHook, pkgconfig, libxslt, xz }: 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 = "25"; 10 11 src = fetchurl { 12 url = "mirror://kernel/linux/utils/kernel/kmod/${name}.tar.xz"; 13 sha256 = "1kgixs4m3jvwk7fb3d18n6j77qhgi9qfv4csj35rs5ancr4ycrbi"; 14 }; 15 16 nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ]; 17 buildInputs = [ xz ]; 18 # HACK until BUG issue #21191 is addressed 19 crossAttrs.preUnpack = ''PATH="${buildPackages.xz}/bin''${PATH:+:}$PATH"''; 20 21 configureFlags = [ 22 "--sysconfdir=/etc" 23 "--with-xz" 24 "--with-modulesdirs=${modulesDirs}" 25 ]; 26 27 patches = [ ./module-dir.patch ]; 28 29 postInstall = '' 30 for prog in rmmod insmod lsmod modinfo modprobe depmod; do 31 ln -sv $out/bin/kmod $out/bin/$prog 32 done 33 34 # Backwards compatibility 35 ln -s bin $out/sbin 36 ''; 37 38 meta = { 39 homepage = https://www.kernel.org/pub/linux/utils/kernel/kmod/; 40 description = "Tools for loading and managing Linux kernel modules"; 41 platforms = stdenv.lib.platforms.linux; 42 }; 43}