2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, zlib
|
|
|
|
, ncurses
|
|
|
|
, findutils
|
|
|
|
, systemd
|
|
|
|
, python3
|
|
|
|
# makes the package unfree via pynvml
|
|
|
|
, withAtopgpu ? false
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "atop";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "2.7.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.atoptool.nl/download/atop-${version}.tar.gz";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-ykjS8X4HHe6tXm6cyeOIv2oycNaV5hl2s3lNTZJ7XE4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = lib.optionals withAtopgpu [
|
|
|
|
python3.pkgs.wrapPython
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
zlib
|
|
|
|
ncurses
|
|
|
|
] ++ lib.optionals withAtopgpu [
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonPath = lib.optionals withAtopgpu [
|
|
|
|
python3.pkgs.pynvml
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
2021-05-20 23:08:51 +00:00
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"BINPATH=/bin"
|
|
|
|
"SBINPATH=/bin"
|
|
|
|
"MAN1PATH=/share/man/man1"
|
|
|
|
"MAN5PATH=/share/man/man5"
|
|
|
|
"MAN8PATH=/share/man/man8"
|
|
|
|
"SYSDPATH=/lib/systemd/system"
|
|
|
|
"PMPATHD=/lib/systemd/system-sleep"
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Fix paths in atop.service, atop-rotate.service, atopgpu.service, atopacct.service,
|
|
|
|
# and atop-pm.sh
|
|
|
|
./fix-paths.patch
|
|
|
|
# Don't fail on missing /etc/default/atop, make sure /var/log/atop exists pre-start
|
|
|
|
./atop.service.patch
|
|
|
|
# Specify PIDFile in /run, not /var/run to silence systemd warning
|
|
|
|
./atopacct.service.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
for f in *.{sh,service}; do
|
|
|
|
findutils=${findutils} systemd=${systemd} substituteAllInPlace "$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
substituteInPlace Makefile --replace 'chown' 'true'
|
|
|
|
substituteInPlace Makefile --replace 'chmod 04711' 'chmod 0711'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
mkdir -p $out/bin
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postInstall = ''
|
2022-06-16 17:23:12 +00:00
|
|
|
# Remove extra files we don't need
|
2021-05-20 23:08:51 +00:00
|
|
|
rm -r $out/{var,etc} $out/bin/atop{sar,}-${version}
|
|
|
|
'' + (if withAtopgpu then ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
'' else ''
|
|
|
|
rm $out/lib/systemd/system/atopgpu.service $out/bin/atopgpud $out/share/man/man8/atopgpud.8
|
|
|
|
'');
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ raskin ];
|
2021-02-05 17:12:51 +00:00
|
|
|
description = "Console system performance monitor";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
2022-06-16 17:23:12 +00:00
|
|
|
Atop is an ASCII full-screen performance monitor that is capable of reporting the activity of
|
|
|
|
all processes (even if processes have finished during the interval), daily logging of system
|
|
|
|
and process activity for long-term analysis, highlighting overloaded system resources by using
|
|
|
|
colors, etc. At regular intervals, it shows system-level activity related to the CPU, memory,
|
|
|
|
swap, disks and network layers, and for every active process it shows the CPU utilization,
|
|
|
|
memory growth, disk utilization, priority, username, state, and exit code.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2020-12-29 15:07:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
downloadPage = "http://atoptool.nl/downloadatop.php";
|
|
|
|
};
|
|
|
|
}
|