2021-05-14 02:08:41 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, zlib
|
|
|
|
, ncurses
|
|
|
|
, findutils
|
|
|
|
, systemd
|
|
|
|
, python3
|
2021-05-17 01:26:22 +02:00
|
|
|
# makes the package unfree via pynvml
|
2021-05-14 02:08:41 +02:00
|
|
|
, withAtopgpu ? false
|
|
|
|
}:
|
2012-08-25 19:24:17 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "atop";
|
2020-12-27 22:55:50 +01:00
|
|
|
version = "2.6.0";
|
2012-08-25 19:24:17 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 20:43:35 +02:00
|
|
|
url = "https://www.atoptool.nl/download/atop-${version}.tar.gz";
|
2020-12-27 22:55:50 +01:00
|
|
|
sha256 = "nsLKOlcWkvfvqglfmaUQZDK8txzCLNbElZfvBIEFj3I=";
|
2012-08-25 19:24:17 +02:00
|
|
|
};
|
|
|
|
|
2021-05-17 01:26:22 +02:00
|
|
|
nativeBuildInputs = lib.optionals withAtopgpu [ python3.pkgs.wrapPython ];
|
|
|
|
buildInputs = [ zlib ncurses ] ++ lib.optionals withAtopgpu [ python3 ];
|
|
|
|
pythonPath = lib.optionals withAtopgpu [ python3.pkgs.pynvml ];
|
2012-08-25 19:24:17 +02:00
|
|
|
|
|
|
|
makeFlags = [
|
2021-05-14 02:08:41 +02: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"
|
2012-08-25 19:24:17 +02:00
|
|
|
];
|
|
|
|
|
2021-05-14 02:08:41 +02:00
|
|
|
patches = [
|
2021-05-16 22:08:05 +02:00
|
|
|
# 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
|
2021-05-14 02:08:41 +02:00
|
|
|
./atop.service.patch
|
2021-05-16 22:08:05 +02:00
|
|
|
# Specify PIDFile in /run, not /var/run to silence systemd warning
|
2021-05-14 02:08:41 +02:00
|
|
|
./atopacct.service.patch
|
2021-05-16 22:08:05 +02:00
|
|
|
];
|
2021-05-14 02:08:41 +02:00
|
|
|
|
2012-08-25 19:24:17 +02:00
|
|
|
preConfigure = ''
|
2021-05-14 02:08:41 +02:00
|
|
|
for f in *.{sh,service}; do
|
|
|
|
findutils=${findutils} systemd=${systemd} substituteAllInPlace "$f"
|
|
|
|
done
|
|
|
|
|
2021-05-17 13:46:55 +02:00
|
|
|
substituteInPlace Makefile --replace 'chown' 'true'
|
|
|
|
substituteInPlace Makefile --replace 'chmod 04711' 'chmod 0711'
|
2012-08-25 19:24:17 +02:00
|
|
|
'';
|
|
|
|
|
2020-12-27 22:55:50 +01:00
|
|
|
installTargets = [ "systemdinstall" ];
|
2014-09-24 11:32:40 +02:00
|
|
|
preInstall = ''
|
2021-05-14 02:08:41 +02:00
|
|
|
mkdir -p $out/bin
|
2014-09-24 11:32:40 +02:00
|
|
|
'';
|
2021-05-14 02:08:41 +02:00
|
|
|
postInstall = ''
|
|
|
|
# remove extra files we don't need
|
2021-05-17 01:26:22 +02:00
|
|
|
rm -r $out/{var,etc} $out/bin/atop{sar,}-${version}
|
2021-05-14 02:08:41 +02:00
|
|
|
'' + (if withAtopgpu then ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
'' else ''
|
2021-05-17 01:26:22 +02:00
|
|
|
rm $out/lib/systemd/system/atopgpu.service $out/bin/atopgpud $out/share/man/man8/atopgpud.8
|
2021-05-14 02:08:41 +02:00
|
|
|
'');
|
2014-09-24 11:32:40 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-08-16 21:21:58 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ raskin ];
|
2021-01-24 10:19:10 +01:00
|
|
|
description = "Console system performance monitor";
|
2012-08-25 19:24:17 +02:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
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-12-27 22:55:50 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-01 03:11:51 +02:00
|
|
|
downloadPage = "http://atoptool.nl/downloadatop.php";
|
2012-08-25 19:24:17 +02:00
|
|
|
};
|
|
|
|
}
|