diff options
author | Philipp Schuster <phip1611@gmail.com> | 2024-04-03 16:34:57 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-06-12 15:29:19 +0200 |
commit | 375801cfcba34b1b2d4360cf54817a114e1411f0 (patch) | |
tree | 30ec661fbd62aadfb70ddd8a4302f075d3224127 /pkgs/by-name/li | |
parent | 36f7f612a9d9a5a024604f6952f76c71ef7e9a3c (diff) |
linux-packages: init at ${linuxHeaders.version}
This exports the standalone scripts from the Linux tree as usable package. For example, they are helpful for OS-space developers and virtualization engineers. For the beginning, this includes: `$ extract-vmlinux path/to/bzImage > vmlinux` `$ extract-ikconfig path/to/bzImage > .config`
Diffstat (limited to 'pkgs/by-name/li')
-rw-r--r-- | pkgs/by-name/li/linux-scripts/package.nix | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/by-name/li/linux-scripts/package.nix b/pkgs/by-name/li/linux-scripts/package.nix new file mode 100644 index 0000000000000..f317538be7e70 --- /dev/null +++ b/pkgs/by-name/li/linux-scripts/package.nix @@ -0,0 +1,64 @@ +{ 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; + }; +} |