Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 131 lines 3.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchzip, 5 fetchpatch, 6 autoconf, 7 automake, 8 docbook_xml_dtd_42, 9 docbook_xml_dtd_43, 10 docbook_xsl, 11 gtk-doc, 12 libtool, 13 pkg-config, 14 libxslt, 15 xz, 16 zstd, 17 elf-header, 18 withDevdoc ? stdenv.hostPlatform == stdenv.buildPlatform, 19 withStatic ? stdenv.hostPlatform.isStatic, 20 gitUpdater, 21}: 22 23let 24 systems = [ 25 "/run/booted-system/kernel-modules" 26 "/run/current-system/kernel-modules" 27 "" 28 ]; 29 modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems; 30 31in 32stdenv.mkDerivation rec { 33 pname = "kmod"; 34 version = "31"; 35 36 # autogen.sh is missing from the release tarball, 37 # and we need to run it to regenerate gtk_doc.make, 38 # because the version in the release tarball is broken. 39 # Possibly this will be fixed in kmod 30? 40 # https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/.gitignore?id=61a93a043aa52ad62a11ba940d4ba93cb3254e78 41 src = fetchzip { 42 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/snapshot/kmod-${version}.tar.gz"; 43 hash = "sha256-FNR015/AoYBbi7Eb1M2TXH3yxUuddKICCu+ot10CdeQ="; 44 }; 45 46 outputs = [ 47 "out" 48 "dev" 49 "lib" 50 ] 51 ++ lib.optional withDevdoc "devdoc"; 52 53 strictDeps = true; 54 nativeBuildInputs = [ 55 autoconf 56 automake 57 docbook_xsl 58 libtool 59 libxslt 60 pkg-config 61 62 docbook_xml_dtd_42 # for the man pages 63 ] 64 ++ lib.optionals withDevdoc [ 65 docbook_xml_dtd_43 66 gtk-doc 67 ]; 68 buildInputs = [ 69 xz 70 zstd 71 ] 72 # gtk-doc is looked for with pkg-config 73 ++ lib.optionals withDevdoc [ gtk-doc ]; 74 75 preConfigure = '' 76 ./autogen.sh 77 ''; 78 79 configureFlags = [ 80 "--sysconfdir=/etc" 81 "--with-xz" 82 "--with-zstd" 83 "--with-modulesdirs=${modulesDirs}" 84 (lib.enableFeature withDevdoc "gtk-doc") 85 ] 86 ++ lib.optional withStatic "--enable-static"; 87 88 patches = [ 89 ./module-dir.patch 90 (fetchpatch { 91 name = "musl.patch"; 92 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/patch/?id=11eb9bc67c319900ab00523997323a97d2d08ad2"; 93 hash = "sha256-CYG615elMWces6QGQRg2H/NL7W4XsG9Zvz5H+xsdFFo="; 94 }) 95 ] 96 ++ lib.optional withStatic ./enable-static.patch; 97 98 postInstall = '' 99 for prog in rmmod insmod lsmod modinfo modprobe depmod; do 100 ln -sv $out/bin/kmod $out/bin/$prog 101 done 102 103 # Backwards compatibility 104 ln -s bin $out/sbin 105 ''; 106 107 passthru.updateScript = gitUpdater { 108 # No nicer place to find latest release. 109 url = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git"; 110 rev-prefix = "v"; 111 }; 112 113 meta = with lib; { 114 description = "Tools for loading and managing Linux kernel modules"; 115 longDescription = '' 116 kmod is a set of tools to handle common tasks with Linux kernel modules 117 like insert, remove, list, check properties, resolve dependencies and 118 aliases. These tools are designed on top of libkmod, a library that is 119 shipped with kmod. 120 ''; 121 homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/"; 122 downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/"; 123 changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}"; 124 license = with licenses; [ 125 lgpl21Plus 126 gpl2Plus 127 ]; # GPLv2+ for tools 128 platforms = platforms.linux; 129 maintainers = with maintainers; [ artturin ]; 130 }; 131}