Skip to content

Commit

Permalink
mrtg: enable ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed May 22, 2024
1 parent 2783b6b commit 72d71dc
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
with lib;

let
mrtg = pkgs.stdenv.mkDerivation rec {
pname = "mrtg";
version = "2.17.10";

src = pkgs.fetchurl {
url = "https://oss.oetiker.ch/mrtg/pub/${pname}-${version}.tar.gz";
sha256 = "sha256-x/EcteIXpQDYfuO10mxYqGUu28DTKRaIu3krAQ+uQ6w=";
};

buildInputs = [
pkgs.gd
pkgs.rrdtool
( pkgs.perl.withPackages (p: with p; [
Socket6
]))
];

};
cfg = config.services.ixp-manager;
package = cfg.package.override {
dataDir = cfg.dataDir;
Expand Down Expand Up @@ -520,18 +538,24 @@ in
description = "Multi-router Traffic Grapher";
after = [ "ixp-manager-setup.service" ];
environment.LANG = "C";
path = [ pkgs.rrdtool ];
startAt = "*:0/1";
path = [ pkgs.rrdtool pkgs.perl538Packages.Socket6 ];
startAt = "*:0/5";
preStart = ''
#${artisanWrapper}/bin/ixp-manager-artisan grapher:generate-configuration -B mrtg -O /var/lib/mrtg/ixpmanager.cfg
#sed -i '/RunAsDaemon/d' /var/lib/mrtg/ixpmanager.cfg
#echo "LibAdd: ${pkgs.rrdtool}/lib/perl5/site_perl" >> /var/lib/mrtg/ixpmanager.cfg
${artisanWrapper}/bin/ixp-manager-artisan grapher:generate-configuration -B mrtg -O /var/lib/mrtg/ixpmanager.cfg
sed -i '/RunAsDaemon/d' /var/lib/mrtg/ixpmanager.cfg
echo "LibAdd: ${pkgs.rrdtool}/lib/perl5/site_perl" >> /var/lib/mrtg/ixpmanager.cfg
echo "EnableIPv6: yes" >> /var/lib/mrtg/ixpmanager.cfg
'';
serviceConfig = {
Type = "simple";
RuntimeDirectory = "mrtg";
StateDirectory = "mrtg";
ExecStart = "${pkgs.mrtg}/bin/mrtg /var/lib/mrtg/ixpmanager.cfg --lock-file=/run/mrtg/mrtg.lock --confcache-file=/var/lib/mrtg/mrtg.ok --debug=\"base\" --logging /var/lib/mrtg/log.log";
ExecStart = "${mrtg.overrideAttrs {
postPatch = ''
sed -i 's|@main::DEBUG=qw();|@main::DEBUG=qw(eval);|' bin/mrtg
'';
}}/bin/mrtg /var/lib/mrtg/ixpmanager.cfg --lock-file=/run/mrtg/mrtg.lock --confcache-file=/var/lib/mrtg/mrtg.ok --debug=\"base\" --logging /var/lib/mrtg/log.log";
User = config.services.ixp-manager.user;
Group = config.services.ixp-manager.group;
};
Expand Down

0 comments on commit 72d71dc

Please sign in to comment.