nixpkgs/pkgs/os-specific/linux/ply/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

43 lines
1.4 KiB
Nix

{ lib, stdenv, kernel, fetchFromGitHub, autoreconfHook, yacc, flex, p7zip, rsync }:
assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "4.0";
let
version = "1.0.beta1-9e810b1";
in stdenv.mkDerivation {
pname = "ply";
inherit version;
nativeBuildInputs = [ autoreconfHook flex yacc p7zip rsync ];
src = fetchFromGitHub {
owner = "iovisor";
repo = "ply";
rev = "9e810b157ba079c32c430a7d4c6034826982056e";
sha256 = "15cp6iczawaqlhsa0af6i37zn5iq53kh6ya8s2hzd018yd7mhg50";
};
preAutoreconf = ''
# If kernel sources are a folder (i.e. fetched from git), we just copy them in
# Since they are owned by uid 0 and read-only, we need to fix permissions
if [ -d ${kernel.src} ]; then
cp -r ${kernel.src} linux-${kernel.version}
chown -R $(whoami): linux-${kernel.version}
chmod -R a+w linux-${kernel.version}
else
# ply wants to install header files to its build directory
# use 7z to handle multiple archive formats transparently
7z x ${kernel.src} -so | 7z x -aoa -si -ttar
fi
configureFlagsArray+=(--with-kerneldir=$(echo $(pwd)/linux-*))
./autogen.sh --prefix=$out
'';
meta = with lib; {
description = "dynamic Tracing in Linux";
homepage = "https://wkz.github.io/ply/";
license = [ licenses.gpl2 ];
maintainers = with maintainers; [ mic92 mbbx6spp ];
};
}