1{ lib, stdenv, fetchurl, perl, linuxPackages_latest }:
2
3stdenv.mkDerivation rec {
4 pname = "linux-manual";
5 inherit (linuxPackages_latest.kernel) version src;
6
7 nativeBuildInputs = [ perl ];
8
9 dontConfigure = true;
10 dontBuild = true;
11
12 postPatch = ''
13 patchShebangs --build \
14 scripts/kernel-doc \
15 scripts/split-man.pl
16 '';
17
18 installPhase = ''
19 mandir=$out/share/man/man9
20 mkdir -p $mandir
21
22 KBUILD_BUILD_TIMESTAMP=$(stat -c %Y Makefile) \
23 grep -F -l -Z \
24 --exclude-dir Documentation \
25 --exclude-dir tools \
26 -R '/**' \
27 | xargs -0 -n 256 -P $NIX_BUILD_CORES \
28 $SHELL -c '{ scripts/kernel-doc -man "$@" || :; } \
29 | scripts/split-man.pl '$mandir kernel-doc
30
31 test -f $mandir/kmalloc.9
32 '';
33
34 meta = with lib; {
35 homepage = "https://kernel.org/";
36 description = "Linux kernel API manual pages";
37 license = licenses.gpl2Only;
38 maintainers = with maintainers; [ mvs ];
39 };
40}