nixpkgs/pkgs/os-specific/linux/procdump/default.nix

50 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, bash, coreutils, gdb, zlib }:
2018-11-15 23:01:19 +00:00
stdenv.mkDerivation rec {
pname = "procdump";
2020-04-05 05:31:22 +01:00
version = "1.1.1";
2018-11-15 23:01:19 +00:00
src = fetchFromGitHub {
owner = "Microsoft";
repo = "ProcDump-for-Linux";
rev = version;
2020-04-05 05:31:22 +01:00
sha256 = "0h5fhk39d10kjbinzw1yp6nr8w8l300mn9qxrkpivdkyfn6bpq2f";
2018-11-15 23:01:19 +00:00
};
nativeBuildInputs = [ zlib ];
buildInputs = [ bash coreutils gdb ];
postPatch = ''
substituteInPlace src/CoreDumpWriter.c \
--replace '"gcore ' '"${gdb}/bin/gcore ' \
--replace '"rm ' '"${coreutils}/bin/rm ' \
--replace '/bin/bash' '${bash}/bin/bash'
'';
makeFlags = [
2019-12-14 19:25:04 +00:00
"DESTDIR=${placeholder "out"}"
2018-11-15 23:01:19 +00:00
"INSTALLDIR=/bin"
"MANDIR=/share/man/man1"
];
2019-12-14 19:25:04 +00:00
doCheck = false; # needs sudo root
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
set +o pipefail
($out/bin/procdump -h | grep "ProcDump v${version}") ||
(echo "ERROR: ProcDump is not the expected version or does not run properly" ; exit 1)
set -o pipefail
runHook postInstallCheck
'';
2018-11-15 23:01:19 +00:00
meta = with lib; {
2018-11-15 23:01:19 +00:00
description = "A Linux version of the ProcDump Sysinternals tool";
2019-12-14 19:25:04 +00:00
homepage = "https://github.com/Microsoft/ProcDump-for-Linux";
2018-11-15 23:01:19 +00:00
license = licenses.mit;
maintainers = with maintainers; [ c0bw3b ];
platforms = platforms.linux;
};
}