nixpkgs/pkgs/os-specific/linux/atop/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

51 lines
1.8 KiB
Nix

{lib, stdenv, fetchurl, zlib, ncurses}:
stdenv.mkDerivation rec {
pname = "atop";
version = "2.6.0";
src = fetchurl {
url = "https://www.atoptool.nl/download/atop-${version}.tar.gz";
sha256 = "nsLKOlcWkvfvqglfmaUQZDK8txzCLNbElZfvBIEFj3I=";
};
buildInputs = [zlib ncurses];
makeFlags = [
"SCRPATH=$out/etc/atop"
"LOGPATH=/var/log/atop"
"INIPATH=$out/etc/rc.d/init.d"
"SYSDPATH=$out/lib/systemd/system"
"CRNPATH=$out/etc/cron.d"
"DEFPATH=$out/etc/default"
"ROTPATH=$out/etc/logrotate.d"
];
preConfigure = ''
sed -e "s@/usr/@$out/@g" -i $(find . -type f )
sed -e "/mkdir.*LOGPATH/s@mkdir@echo missing dir @" -i Makefile
sed -e "/touch.*LOGPATH/s@touch@echo should have created @" -i Makefile
sed -e 's/chown/true/g' -i Makefile
sed -e '/chkconfig/d' -i Makefile
sed -e 's/chmod 04711/chmod 0711/g' -i Makefile
'';
installTargets = [ "systemdinstall" ];
preInstall = ''
mkdir -p "$out"/{bin,sbin}
'';
meta = with lib; {
platforms = platforms.linux;
maintainers = with maintainers; [ raskin ];
description = ''Console system performance monitor'';
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.
'';
inherit version;
license = licenses.gpl2Plus;
downloadPage = "http://atoptool.nl/downloadatop.php";
};
}