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