]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add thruk package
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 5 Jul 2019 07:08:49 +0000 (09:08 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 5 Jul 2019 07:09:06 +0000 (09:09 +0200)
pkgs/default.nix
pkgs/thruk/default.nix [new file with mode: 0644]

index ff9d477b10fdfd6349b48aabe14f73e061afdc0a..fd00be7f56477c6e6d2f2b701e7675f530bda670 100644 (file)
@@ -29,6 +29,8 @@ rec {
   tiv = callPackage ../pkgs/tiv {};
   unicodeDoc = callPackage ../pkgs/unicode {};
 
+  thruk = callPackage ./thruk {};
+
   cardano = callPackage ../pkgs/crypto/cardano { inherit mylibs; };
   iota-cli-app = callPackage ../pkgs/crypto/iota-cli-app { inherit mylibs; };
   sia = callPackage ../pkgs/crypto/sia {};
diff --git a/pkgs/thruk/default.nix b/pkgs/thruk/default.nix
new file mode 100644 (file)
index 0000000..444aa87
--- /dev/null
@@ -0,0 +1,47 @@
+{ buildPerlPackage, perl, perlPackages, fetchurl, fetchFromGitHub }:
+buildPerlPackage rec {
+  name = "thruk-${version}";
+  version = "2.30-3";
+  src = fetchFromGitHub {
+    rev = "v${version}";
+    owner = "sni";
+    repo = "Thruk";
+    sha256 = "1vm3p0xsw44lw2p70gl9grc5rlnpb34yafgxll81vc8v653v5wwi";
+  };
+  preConfigure = ''
+    patchShebangs .
+    sed -i support/standard_script_header -e "s|exec perl|exec $perl/bin/perl $perlFlags|"
+    sed -i -e "/^#!/s/- perl -/-perl-/" support/standard_script_header
+    '';
+  preInstall = ''
+    sed -i -e "s@.{DESTDIR}.{TMPDIR}/reports .{DESTDIR}.{LOGDIR}@@" \
+      -e "/DESTDIR}.{TMPDIR/d" \
+      -e "/DESTDIR}.{LOCALSTATEDIR/d" \
+      -e "/DESTDIR}.{LOGDIR/d" Makefile
+    '';
+  postInstall = ''
+    rm -rf $out/var $out/tmp
+    '';
+  configureFlags = [
+    "--localstatedir=/var/lib/naemon/thruk"
+    "--libdir=/var/lib"
+    "--sysconfdir=$(out)/etc/thruk"
+    "--with-httpd-conf=$(out)/etc/httpd"
+    "--datadir=$(out)/share/thruk"
+    "--with-logdir=/var/log/thruk"
+    "--with-checkresultdir=/var/cache/naemon/checkresults"
+    "--with-tempdir=/var/lib/naemon/thruk"
+    "--with-thruk-user=immae"
+    "--with-thruk-group=immae"
+    ];
+  outputs = [ "out" ];
+  buildInputs = [ perl ];
+  propagatedBuildInputs = with perlPackages; [ DateCalc FCGI
+    FileSlurp GD HTMLParser JSONXS LogDispatch Log4Perl LWPProtocolHttps
+    MIMELite Plack TemplateToolkit URI ModuleInstall CpanelJSONXS
+    DateManip DateTime DateTimeTimeZone IOString LWPProtocolconnect DBI
+    DBDmysql HTMLEscape
+  ];
+  doCheck = false;
+  installTargets = "install";
+}