Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

43 lines
1.1 KiB
Nix

{
apple-sdk,
libutil,
mkAppleDerivation,
ncurses,
pkg-config,
}:
let
xnu = apple-sdk.sourceRelease "xnu";
in
mkAppleDerivation {
releaseName = "top";
xcodeHash = "sha256-YeBhEstvPh8IX8ArVc7U8IRU6vqPoOE6kBTqcqZonGc=";
patches = [
# Upstream removed aarch64 support from the 137 source release, but the removal can be reverted.
# Otherwise, top will fail to run on aarch64-darwin.
# Based on https://github.com/apple-oss-distributions/top/commit/a989bd5d18246e330e5feadd80958b913351f8ae.diff
./patches/0001-Revert-change-that-dropped-aarch64-support.patch
];
postPatch = ''
# Fix duplicate symbol error. `tsamp` is unused in `main.c`.
substituteInPlace main.c \
--replace-fail 'const libtop_tsamp_t *tsamp;' ""
# Adding the whole sys folder causes header conflicts, so copy only the private headers that are needed.
mkdir sys
cp ${xnu}/bsd/sys/{kern_memorystatus.h,reason.h} sys/
'';
buildInputs = [
libutil
ncurses
];
nativeBuildInputs = [ pkg-config ];
meta.description = "Display information about processes";
}