depot/third_party/nixpkgs/pkgs/by-name/li/linux-scripts/package.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

64 lines
1.2 KiB
Nix

{ lib
, linuxHeaders # Linux source tree
, makeWrapper
, stdenvNoCC
, binutils
, coreutils
, gnugrep
# decompressors for possible kernel image formats
, bzip2
, gzip
, lz4
, lzop
, xz
, zstd
}:
let
commonDeps = [
binutils
coreutils
gnugrep
gzip
xz
bzip2
lzop
lz4
zstd
];
toWrapScriptLines = scriptName: ''
install -Dm 0755 scripts/${scriptName} $out/bin/${scriptName}
wrapProgram $out/bin/${scriptName} --prefix PATH : ${lib.makeBinPath commonDeps}
'';
in
stdenvNoCC.mkDerivation
{
inherit (linuxHeaders) version;
pname = "linux-scripts";
# These scripts will rarely change and are usually not bound to a specific
# version of Linux. So it is okay to just use whatever Linux version comes
# from `linuxHeaders.
src = linuxHeaders.src;
nativeBuildInputs = [ makeWrapper ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
${toWrapScriptLines "extract-ikconfig"}
${toWrapScriptLines "extract-vmlinux"}
'';
meta = with lib; {
description = "Standalone scripts from <linux>/scripts";
homepage = "https://www.kernel.org/";
license = licenses.gpl2Only;
maintainers = [ maintainers.phip1611 ];
platforms = platforms.all;
};
}