2021-05-20 23:08:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, kernel, kmod, zlib }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "netatop-${kernel.version}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.atoptool.nl/download/netatop-${version}.tar.gz";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "0qjw8glfdmngfvbn1w63q128vxdz2jlabw13y140ga9i5ibl6vvk";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [ kmod zlib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
hardeningDisable = [ "pic" ];
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=implicit-fallthrough" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +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
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs mkversion
|
|
|
|
sed -i -e 's,^KERNDIR.*,KERNDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build,' \
|
|
|
|
*/Makefile
|
|
|
|
sed -i -e 's,/lib/modules.*extra,'$out'/lib/modules/${kernel.modDirVersion}/extra,' \
|
|
|
|
-e s,/usr,$out, \
|
|
|
|
-e /init.d/d \
|
|
|
|
-e /depmod/d \
|
2021-05-20 23:08:51 +00:00
|
|
|
-e s,/lib/systemd,$out/lib/systemd, \
|
2020-04-24 23:36:52 +00:00
|
|
|
Makefile
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
kmod=${kmod} substituteAllInPlace netatop.service
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
makeFlags = kernel.makeFlags;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preInstall = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
mkdir -p $out/lib/systemd/system $out/bin $out/sbin $out/share/man/man{4,8}
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Network monitoring module for atop";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "netatopd";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.atoptool.nl/downloadnetatop.php";
|
2024-06-24 18:47:55 +00:00
|
|
|
license = lib.licenses.gpl2Only;
|
2021-02-05 17:12:51 +00:00
|
|
|
platforms = lib.platforms.linux;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|