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

62 lines
1.7 KiB
Nix
Raw Normal View History

2022-02-02 08:07:19 +00:00
{ lib, stdenv, fetchFromGitHub, fetchpatch, bash, coreutils, gdb, zlib }:
2018-11-15 23:01:19 +00:00
stdenv.mkDerivation rec {
pname = "procdump";
2021-09-18 12:31:17 +00:00
version = "1.2";
2018-11-15 23:01:19 +00:00
src = fetchFromGitHub {
owner = "Microsoft";
repo = "ProcDump-for-Linux";
rev = version;
2021-09-18 12:31:17 +00:00
sha256 = "sha256-gVswAezHl7E2cBTJEQhPFXhHkzhWVHSpPF8m0s8+ekc=";
2018-11-15 23:01:19 +00:00
};
2022-02-02 08:07:19 +00:00
patches = [
# Pull upstream patch to fix parallel builds:
# https://github.com/Sysinternals/ProcDump-for-Linux/pull/133
(fetchpatch {
name = "parallel.patch";
url = "https://github.com/Sysinternals/ProcDump-for-Linux/commit/0d735836f11281cc6134be93eac8acb302f2055e.patch";
sha256 = "sha256-zsqllPHF8ZuXAIDSAPvbzdKa43uSSx9ilUKM1vFVW90=";
})
];
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"
];
2022-02-02 08:07:19 +00:00
enableParallelBuilding = true;
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;
};
}