@ -1,5 +1,7 @@
{ stdenv , lib , fetchurl , autoreconfHook , pkg-config
{ stdenv , lib , fetchzip , autoconf , automake , docbook_xml_dtd_42
, docbook_xml_dtd_43 , docbook_xsl , gtk-doc , libtool , pkg-config
, libxslt , xz , zstd , elf-header
, withDevdoc ? stdenv . hostPlatform == stdenv . buildPlatform
, withStatic ? stdenv . hostPlatform . isStatic
} :
@ -11,21 +13,35 @@ in stdenv.mkDerivation rec {
pname = " k m o d " ;
version = " 2 9 " ;
src = fetchurl {
url = " m i r r o r : / / k e r n e l / l i n u x / u t i l s / k e r n e l / ${ pname } / ${ pname } - ${ version } . t a r . x z " ;
sha256 = " 0 a m 5 4 m i 5 r k 7 2 g 5 q 7 k 6 l 6 f 3 6 g w 3 r 9 v w g j m y n a 4 3 y w c j h q m a k y x 0 0 b " ;
# autogen.sh is missing from the release tarball,
# and we need to run it to regenerate gtk_doc.make,
# because the version in the release tarball is broken.
# Possibly this will be fixed in kmod 30?
# https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/.gitignore?id=61a93a043aa52ad62a11ba940d4ba93cb3254e78
src = fetchzip {
url = " h t t p s : / / g i t . k e r n e l . o r g / p u b / s c m / u t i l s / k e r n e l / k m o d / k m o d . g i t / s n a p s h o t / k m o d - ${ version } . t a r . g z " ;
sha256 = " s h a 2 5 6 - 7 O 5 V d B d 8 r B Z d I E R P E + 2 z k j j 5 P O v S u r w l V 2 E p W m k F U D 0 = " ;
} ;
outputs = [ " o u t " " d e v " " l i b " ] ;
outputs = [ " o u t " " d e v " " l i b " ] ++ lib . optional withDevdoc " d e v d o c " ;
nativeBuildInputs = [ autoreconfHook pkg-config libxslt ] ;
nativeBuildInputs = [
autoconf automake docbook_xsl libtool libxslt pkg-config
docbook_xml_dtd_42 # for the man pages
] ++ lib . optionals withDevdoc [ docbook_xml_dtd_43 gtk-doc ] ;
buildInputs = [ xz zstd ] ++ lib . optional stdenv . isDarwin elf-header ;
preConfigure = ''
./autogen.sh
'' ;
configureFlags = [
" - - s y s c o n f d i r = / e t c "
" - - w i t h - x z "
" - - w i t h - z s t d "
" - - w i t h - m o d u l e s d i r s = ${ modulesDirs } "
( lib . enableFeature withDevdoc " g t k - d o c " )
] ++ lib . optional withStatic " - - e n a b l e - s t a t i c " ;
patches = [ ./module-dir.patch ]