nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 60 lines 1.9 kB view raw
1{ fetchgit, pkgconfig, gettext, runCommand, makeWrapper 2, elfutils, kernel, gnumake, python2, python2Packages 3}: 4 5let 6 ## fetchgit info 7 url = git://sourceware.org/git/systemtap.git; 8 rev = "release-${version}"; 9 sha256 = "0mmpiq7bsrwhp7z07a1pwka4q6d2fbmdx5wp83nxj31rvdxhqwnw"; 10 version = "4.1"; 11 12 inherit (kernel) stdenv; 13 inherit (stdenv) lib; 14 15 ## stap binaries 16 stapBuild = stdenv.mkDerivation { 17 pname = "systemtap"; 18 inherit version; 19 src = fetchgit { inherit url rev sha256; }; 20 nativeBuildInputs = [ pkgconfig ]; 21 buildInputs = [ elfutils gettext python2 python2Packages.setuptools ]; 22 enableParallelBuilding = true; 23 }; 24 25 ## a kernel build dir as expected by systemtap 26 kernelBuildDir = runCommand "kbuild-${kernel.version}-merged" { } '' 27 mkdir -p $out 28 for f in \ 29 ${kernel}/System.map \ 30 ${kernel.dev}/vmlinux \ 31 ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build/{*,.*} 32 do 33 ln -s $(readlink -f $f) $out 34 done 35 ''; 36 37 pypkgs = with python2Packages; makePythonPath [ pyparsing ]; 38 39in runCommand "systemtap-${kernel.version}-${version}" { 40 inherit stapBuild kernelBuildDir; 41 buildInputs = [ makeWrapper ]; 42 meta = { 43 homepage = https://sourceware.org/systemtap/; 44 repositories.git = url; 45 description = "Provides a scripting language for instrumentation on a live kernel plus user-space"; 46 license = lib.licenses.gpl2; 47 platforms = lib.platforms.linux; 48 }; 49} '' 50 mkdir -p $out/bin 51 for bin in $stapBuild/bin/*; do 52 ln -s $bin $out/bin 53 done 54 rm $out/bin/stap $out/bin/dtrace 55 makeWrapper $stapBuild/bin/stap $out/bin/stap \ 56 --add-flags "-r $kernelBuildDir" \ 57 --prefix PATH : ${lib.makeBinPath [ stdenv.cc.cc stdenv.cc.bintools elfutils gnumake ]} 58 makeWrapper $stapBuild/bin/dtrace $out/bin/dtrace \ 59 --prefix PYTHONPATH : ${pypkgs} 60''