vnstat: 2.1 -> 2.2

https://humdi.net/vnstat/CHANGES

* enable tests
* add hardening options from upstream's
  example service
* fix "documentation" setting in service:
  either needs to be `unitConfig.Documentation`
  (uppercase) or lowercase but not within unitConfig.
This commit is contained in:
Will Dietz 2019-05-03 01:46:41 -05:00
parent f58482658e
commit 329df95958
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 = ''