2021-05-14 00:07:17 +00:00
|
|
|
{ lib, stdenv, fetchurl, kernel, kmod, zlib }:
|
2013-05-20 08:00:03 +00:00
|
|
|
|
2016-01-07 09:06:40 +00:00
|
|
|
let
|
2020-09-14 13:34:32 +00:00
|
|
|
version = "3.1";
|
2016-01-07 09:06:40 +00:00
|
|
|
in
|
2014-10-10 19:35:13 +00:00
|
|
|
|
2013-05-20 08:00:03 +00:00
|
|
|
stdenv.mkDerivation {
|
2016-01-07 09:06:40 +00:00
|
|
|
name = "netatop-${kernel.version}-${version}";
|
2013-05-20 08:00:03 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-01-07 09:06:40 +00:00
|
|
|
url = "http://www.atoptool.nl/download/netatop-${version}.tar.gz";
|
2020-09-14 13:34:32 +00:00
|
|
|
sha256 = "0qjw8glfdmngfvbn1w63q128vxdz2jlabw13y140ga9i5ibl6vvk";
|
2013-05-20 08:00:03 +00:00
|
|
|
};
|
|
|
|
|
2022-02-10 02:28:35 +00:00
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
2021-05-14 00:07:17 +00:00
|
|
|
buildInputs = [ kmod zlib ];
|
2013-05-20 08:00:03 +00:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "pic" ];
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=implicit-fallthrough" ];
|
2016-02-12 02:46:35 +00:00
|
|
|
|
2021-05-16 20:07:24 +00:00
|
|
|
patches = [
|
|
|
|
# fix paths in netatop.service
|
|
|
|
./fix-paths.patch
|
|
|
|
# Specify PIDFile in /run, not /var/run to silence systemd warning
|
|
|
|
./netatop.service.patch
|
|
|
|
];
|
2013-05-20 08:00:03 +00:00
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs mkversion
|
2014-01-05 01:57:21 +00:00
|
|
|
sed -i -e 's,^KERNDIR.*,KERNDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build,' \
|
2013-05-20 08:00:03 +00:00
|
|
|
*/Makefile
|
2014-01-05 01:57:21 +00:00
|
|
|
sed -i -e 's,/lib/modules.*extra,'$out'/lib/modules/${kernel.modDirVersion}/extra,' \
|
2013-05-20 08:00:03 +00:00
|
|
|
-e s,/usr,$out, \
|
|
|
|
-e /init.d/d \
|
|
|
|
-e /depmod/d \
|
2021-05-14 00:07:17 +00:00
|
|
|
-e s,/lib/systemd,$out/lib/systemd, \
|
2013-05-20 08:00:03 +00:00
|
|
|
Makefile
|
2021-05-14 00:07:17 +00:00
|
|
|
|
|
|
|
kmod=${kmod} substituteAllInPlace netatop.service
|
2013-05-20 08:00:03 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 02:28:35 +00:00
|
|
|
makeFlags = kernel.makeFlags;
|
|
|
|
|
2013-05-20 08:00:03 +00:00
|
|
|
preInstall = ''
|
2021-05-14 00:07:17 +00:00
|
|
|
mkdir -p $out/lib/systemd/system $out/bin $out/sbin $out/share/man/man{4,8}
|
2014-06-30 12:56:10 +00:00
|
|
|
mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra
|
2013-05-20 08:00:03 +00:00
|
|
|
'';
|
2016-01-07 09:06:40 +00:00
|
|
|
|
2013-05-20 08:00:03 +00:00
|
|
|
meta = {
|
|
|
|
description = "Network monitoring module for atop";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.atoptool.nl/downloadnetatop.php";
|
2021-01-15 14:45:37 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
2021-05-14 00:07:17 +00:00
|
|
|
maintainers = with lib.maintainers; [ viric ];
|
2013-05-20 08:00:03 +00:00
|
|
|
};
|
|
|
|
}
|