Merge pull request #60569 from dtzWill/update/vnstat-2.2

vnstat: 2.1 -> 2.2
This commit is contained in:
Renaud 2019-05-09 20:09:40 +02:00 committed by GitHub
commit c17ec06f66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 7 deletions

View file

@ -28,14 +28,29 @@ in {
path = [ pkgs.coreutils ];
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
unitConfig.documentation = "man:vnstatd(1) man:vnstat(1) man:vnstat.conf(5)";
documentation = [
"man:vnstatd(1)"
"man:vnstat(1)"
"man:vnstat.conf(5)"
];
preStart = "chmod 755 /var/lib/vnstat";
serviceConfig = {
ExecStart = "${pkgs.vnstat}/bin/vnstatd -n";
ExecReload = "${pkgs.procps}/bin/kill -HUP $MAINPID";
ProtectHome = true;
# Hardening (from upstream example service)
ProtectSystem = "strict";
StateDirectory = "vnstat";
PrivateDevices = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectKernelModules = true;
PrivateTmp = true;
MemoryDenyWriteExecute = true;
RestrictRealtime = true;
RestrictNamespaces = true;
User = "vnstatd";
};
};

View file

@ -1,20 +1,25 @@
{ stdenv, fetchurl, gd, ncurses, sqlite }:
{ stdenv, fetchurl, pkgconfig, gd, ncurses, sqlite, check }:
stdenv.mkDerivation rec {
name = "vnstat-${version}";
pname = "vnstat";
version = "2.2";
src = fetchurl {
sha256 = "0b7020rlc568pz6vkiy28kl8493z88wzrn18wv9b0iq2bv1pn2n6";
url = "https://humdi.net/vnstat/${name}.tar.gz";
url = "https://humdi.net/${pname}/${pname}-${version}.tar.gz";
};
buildInputs = [ gd ncurses sqlite ];
postPatch = ''
substituteInPlace src/cfg.c --replace /usr/local $out
'';
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ gd ncurses sqlite ];
checkInputs = [ check ];
doCheck = true;
meta = with stdenv.lib; {
description = "Console-based network statistics utility for Linux";
longDescription = ''