at 22.05-pre 56 lines 1.9 kB view raw
1{ stdenv, lib, fetchurl, autoreconfHook, pkg-config 2, libxslt, xz, zstd, elf-header 3, withStatic ? stdenv.hostPlatform.isStatic 4}: 5 6let 7 systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ]; 8 modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems; 9 10in stdenv.mkDerivation rec { 11 pname = "kmod"; 12 version = "29"; 13 14 src = fetchurl { 15 url = "mirror://kernel/linux/utils/kernel/${pname}/${pname}-${version}.tar.xz"; 16 sha256 = "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b"; 17 }; 18 19 nativeBuildInputs = [ autoreconfHook pkg-config libxslt ]; 20 buildInputs = [ xz zstd ] ++ lib.optional stdenv.isDarwin elf-header; 21 22 configureFlags = [ 23 "--sysconfdir=/etc" 24 "--with-xz" 25 "--with-zstd" 26 "--with-modulesdirs=${modulesDirs}" 27 ] ++ lib.optional withStatic "--enable-static"; 28 29 patches = [ ./module-dir.patch ] 30 ++ lib.optional stdenv.isDarwin ./darwin.patch 31 ++ lib.optional withStatic ./enable-static.patch; 32 33 postInstall = '' 34 for prog in rmmod insmod lsmod modinfo modprobe depmod; do 35 ln -sv $out/bin/kmod $out/bin/$prog 36 done 37 38 # Backwards compatibility 39 ln -s bin $out/sbin 40 ''; 41 42 meta = with lib; { 43 description = "Tools for loading and managing Linux kernel modules"; 44 longDescription = '' 45 kmod is a set of tools to handle common tasks with Linux kernel modules 46 like insert, remove, list, check properties, resolve dependencies and 47 aliases. These tools are designed on top of libkmod, a library that is 48 shipped with kmod. 49 ''; 50 homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/"; 51 downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/"; 52 changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}"; 53 license = with licenses; [ lgpl21Plus gpl2Plus ]; # GPLv2+ for tools 54 platforms = platforms.unix; 55 }; 56}