1{
2 lib,
3 linuxHeaders, # Linux source tree
4 makeWrapper,
5 stdenvNoCC,
6
7 binutils,
8 coreutils,
9 gnugrep,
10
11 # decompressors for possible kernel image formats
12 bzip2,
13 gzip,
14 lz4,
15 lzop,
16 xz,
17 zstd,
18}:
19
20let
21 commonDeps = [
22 binutils
23 coreutils
24 gnugrep
25 gzip
26 xz
27 bzip2
28 lzop
29 lz4
30 zstd
31 ];
32
33 toWrapScriptLines = scriptName: ''
34 install -Dm 0755 scripts/${scriptName} $out/bin/${scriptName}
35 wrapProgram $out/bin/${scriptName} --prefix PATH : ${lib.makeBinPath commonDeps}
36 '';
37in
38stdenvNoCC.mkDerivation {
39 inherit (linuxHeaders) version;
40 pname = "linux-scripts";
41
42 # These scripts will rarely change and are usually not bound to a specific
43 # version of Linux. So it is okay to just use whatever Linux version comes
44 # from `linuxHeaders.
45 src = linuxHeaders.src;
46
47 nativeBuildInputs = [ makeWrapper ];
48
49 dontConfigure = true;
50 dontBuild = true;
51
52 installPhase = ''
53 ${toWrapScriptLines "extract-ikconfig"}
54 ${toWrapScriptLines "extract-vmlinux"}
55 '';
56
57 meta = with lib; {
58 description = "Standalone scripts from <linux>/scripts";
59 homepage = "https://www.kernel.org/";
60 license = licenses.gpl2Only;
61 maintainers = [ maintainers.phip1611 ];
62 platforms = platforms.all;
63 };
64}