diff --git a/pkgs/os-specific/linux/atop/atop.service.patch b/pkgs/os-specific/linux/atop/atop.service.patch index 3ef59e60cbc0..0516e5159b9d 100644 --- a/pkgs/os-specific/linux/atop/atop.service.patch +++ b/pkgs/os-specific/linux/atop/atop.service.patch @@ -1,10 +1,16 @@ +diff --git a/atop.service b/atop.service +index 6b11dea..f90935f 100644 --- a/atop.service +++ b/atop.service -@@ -9,5 +9,6 @@ - Environment=LOGPATH=/var/log/atop +@@ -8,10 +8,10 @@ Environment="LOGOPTS=" + Environment="LOGINTERVAL=600" + Environment="LOGGENERATIONS=28" + Environment="LOGPATH=/var/log/atop" -EnvironmentFile=/etc/default/atop +EnvironmentFile=-/etc/default/atop + ExecStartPre=/bin/sh -c 'test -d "${LOGPATH}" || mkdir -p "${LOGPATH}"' ExecStartPre=/bin/sh -c 'test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL"' ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"' -+ExecStartPre=/bin/sh -c 'mkdir -p "${LOGPATH}"' ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}' + ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \; + KillSignal=SIGUSR2 diff --git a/pkgs/os-specific/linux/atop/atopacct.service.patch b/pkgs/os-specific/linux/atop/atopacct.service.patch deleted file mode 100644 index 9f2cd8f2e9ca..000000000000 --- a/pkgs/os-specific/linux/atop/atopacct.service.patch +++ /dev/null @@ -1,7 +0,0 @@ ---- a/atopacct.service -+++ b/atopacct.service -@@ -9,3 +9,3 @@ - Type=forking --PIDFile=/var/run/atopacctd.pid -+PIDFile=/run/atopacctd.pid - ExecStart=@out@/bin/atopacctd diff --git a/pkgs/os-specific/linux/atop/default.nix b/pkgs/os-specific/linux/atop/default.nix index 808d1bc42376..df6bc7c3d7fb 100644 --- a/pkgs/os-specific/linux/atop/default.nix +++ b/pkgs/os-specific/linux/atop/default.nix @@ -1,8 +1,10 @@ { lib , stdenv , fetchurl +, glib , zlib , ncurses +, pkg-config , findutils , systemd , python3 @@ -12,11 +14,11 @@ stdenv.mkDerivation rec { pname = "atop"; - version = "2.8.1"; + version = "2.10.0"; src = fetchurl { url = "https://www.atoptool.nl/download/atop-${version}.tar.gz"; - sha256 = "sha256-lwBYoZt5w0RPlx+FRXKg5jiR3C1fcDf/g3VwhUzg2h4="; + hash = "sha256-56ZzzyyCV4592C7LDeyD/Z7LMIKLJWHCip+lqvddX5M="; }; nativeBuildInputs = lib.optionals withAtopgpu [ @@ -24,8 +26,10 @@ stdenv.mkDerivation rec { ]; buildInputs = [ + glib zlib ncurses + pkg-config ] ++ lib.optionals withAtopgpu [ python3 ]; @@ -51,8 +55,6 @@ stdenv.mkDerivation rec { ./fix-paths.patch # Don't fail on missing /etc/default/atop, make sure /var/log/atop exists pre-start ./atop.service.patch - # Specify PIDFile in /run, not /var/run to silence systemd warning - ./atopacct.service.patch ]; preConfigure = '' diff --git a/pkgs/os-specific/linux/atop/fix-paths.patch b/pkgs/os-specific/linux/atop/fix-paths.patch index e6cd631d3c11..0d4b8c9641c3 100644 --- a/pkgs/os-specific/linux/atop/fix-paths.patch +++ b/pkgs/os-specific/linux/atop/fix-paths.patch @@ -1,42 +1,10 @@ ---- a/atop.service -+++ b/atop.service -@@ -12,4 +12,4 @@ - ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"' --ExecStart=/bin/sh -c 'exec /usr/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}' --ExecStartPost=/usr/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \; -+ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}' -+ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \; - KillSignal=SIGUSR2 - ---- a/atop-rotate.service -+++ b/atop-rotate.service -@@ -4,3 +4,3 @@ - [Service] - Type=oneshot --ExecStart=/usr/bin/systemctl try-restart atop.service -+ExecStart=@systemd@/bin/systemctl try-restart atop.service - ---- a/atopgpu.service -+++ b/atopgpu.service -@@ -6,5 +6,5 @@ - - [Service] --ExecStart=/usr/sbin/atopgpud -+ExecStart=@out@/bin/atopgpud - Type=oneshot - RemainAfterExit=yes - ---- a/atopacct.service -+++ b/atopacct.service -@@ -10,3 +10,3 @@ - PIDFile=/var/run/atopacctd.pid --ExecStart=/usr/sbin/atopacctd -+ExecStart=@out@/bin/atopacctd - +diff --git a/atop-pm.sh b/atop-pm.sh +index 3ff4ab5..c433b1a 100755 --- a/atop-pm.sh +++ b/atop-pm.sh -@@ -2,8 +2,8 @@ - +@@ -1,10 +1,10 @@ + #!/bin/sh + case "$1" in - pre) /usr/bin/systemctl stop atop + pre) @systemd@/bin/systemctl stop atop @@ -46,3 +14,55 @@ + post) @systemd@/bin/systemctl start atop exit 0 ;; + *) exit 1 +diff --git a/atop-rotate.service b/atop-rotate.service +index dbe8e0f..4eaa84d 100644 +--- a/atop-rotate.service ++++ b/atop-rotate.service +@@ -4,4 +4,4 @@ Documentation=man:atop(1) + + [Service] + Type=oneshot +-ExecStart=/usr/bin/systemctl restart atop.service ++ExecStart=@systemd@/bin/systemctl restart atop.service +diff --git a/atop.service b/atop.service +index 3e5bafd..6b11dea 100644 +--- a/atop.service ++++ b/atop.service +@@ -12,8 +12,8 @@ EnvironmentFile=/etc/default/atop + ExecStartPre=/bin/sh -c 'test -d "${LOGPATH}" || mkdir -p "${LOGPATH}"' + ExecStartPre=/bin/sh -c 'test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL"' + ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"' +-ExecStart=/bin/sh -c 'exec /usr/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}' +-ExecStartPost=/usr/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \; ++ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}' ++ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \; + KillSignal=SIGUSR2 + + [Install] +diff --git a/atopacct.service b/atopacct.service +index 3aa529d..b95db43 100644 +--- a/atopacct.service ++++ b/atopacct.service +@@ -7,7 +7,7 @@ Before=atop.service + Type=forking + PIDFile=/run/atopacctd.pid + ExecStartPre=/bin/sh -c 'if systemctl -q is-active acct psacct; then echo "Process accounting already in use by (ps)acct"; exit 1; fi' +-ExecStart=/usr/sbin/atopacctd ++ExecStart=@out@/bin/atopacctd + + [Install] + WantedBy=multi-user.target +diff --git a/atopgpu.service b/atopgpu.service +index 4839235..8aae1c5 100644 +--- a/atopgpu.service ++++ b/atopgpu.service +@@ -4,7 +4,7 @@ Documentation=man:atopgpud(8) + Before=atop.service + + [Service] +-ExecStart=/usr/sbin/atopgpud ++ExecStart=@out@/bin/atopgpud + Type=oneshot + RemainAfterExit=yes +