--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/custom-packages.nix Wed Mar 23 15:20:11 2016 +0100
@@ -0,0 +1,16 @@
+{ system ? builtins.currentSystem }:
+
+let
+ pkgs = import <nixpkgs> { inherit system; };
+
+ stdenv.lib.maintainers = stdenv.lib.maintainers // {tzeman = "Tomáš Zeman <tzeman@volny.cz>";};
+
+ callPackage = pkgs.lib.callPackageWith (pkgs // pkgs.xlibs // self);
+
+ self = {
+ qmailanalog = callPackage ./pkgs/qmailanalog { };
+ };
+in
+self
+
+# vim: et ts=2 sw=2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgs/qmailanalog/default.nix Wed Mar 23 15:20:11 2016 +0100
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, libtool, groff }:
+
+let
+ pkg = "qmailanalog";
+ ver = "0.70";
+ web = https://cr.yp.to;
+in stdenv.mkDerivation rec {
+ name = "${pkg}-${ver}";
+
+ src = fetchurl {
+ url = "${web}/software/${pkg}-${ver}.tar.gz";
+ sha256 = "0nx5k0vxzly50k95d6zaidnac0hlzdbqcmpgkp8fh34qbk1z8xiv";
+ };
+
+ buildInputs = [libtool groff];
+
+ configurePhase = ''
+ echo $out > conf-home
+ '';
+
+ installTargets = "setup check";
+
+ patches = [
+ ./errno.patch
+ ./matchup.c-taia.patch
+ ];
+
+ meta = {
+ description = "Collection of tools to help analyze qmail's activity record";
+ homepage = "${web}/${pkg}.html";
+ license = stdenv.lib.licenses.publicDomain.shortName;
+ platforms = stdenv.lib.platforms.gnu;
+ #maintainers = stdenv.lib.maintainers.tzeman;
+ };
+}
+
+# vim: et ts=2 sw=2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgs/qmailanalog/errno.patch Wed Mar 23 15:20:11 2016 +0100
@@ -0,0 +1,14 @@
+errno fix
+
+diff -r c045670f36e9 error.h
+--- a/error.h Thu Nov 01 14:46:11 2007 +0100
++++ b/error.h Thu Nov 01 15:02:39 2007 +0100
+@@ -1,7 +1,7 @@
+ #ifndef ERROR_H
+ #define ERROR_H
+
+-extern int errno;
++#include <errno.h>
+
+ extern int error_intr;
+ extern int error_nomem;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgs/qmailanalog/matchup.c-taia.patch Wed Mar 23 15:20:11 2016 +0100
@@ -0,0 +1,65 @@
+http://www.morettoni.net/qmail/matchup.c-taia.patch
+
+*** qmailanalog-0.70.orig/matchup.c Fri Jul 1 12:28:28 2005
+--- qmailanalog-0.70/matchup.c Fri Jul 1 14:06:04 2005
+***************
+*** 417,422 ****
+--- 417,463 ----
+
+ stralloc outline = {0};
+
++ void fix_taia()
++ {
++ stralloc tai = {0};
++ stralloc tmp = {0};
++ char *p = line.s+field[0]+1;
++ unsigned long secs;
++ unsigned long nanosecs;
++ unsigned long u;
++ char ch;
++
++ secs = 0;
++ nanosecs = 0;
++ for (;;) {
++ ch = *p++;
++ u = ch - '0';
++ if (u >= 10) {
++ u = ch - 'a';
++ if (u >= 6) break;
++ u += 10;
++ }
++ secs <<= 4;
++ secs += nanosecs >> 28;
++ nanosecs &= 0xfffffff;
++ nanosecs <<= 4;
++ nanosecs += u;
++ }
++ secs -= 4611686018427387914ULL;
++
++ if (!stralloc_copyb(&tai, strnum,fmt_ulong(strnum,secs))) nomem();
++ if (!stralloc_cats(&tai,".")) nomem();
++ if (!stralloc_catb(&tai, strnum,fmt_ulong(strnum,nanosecs))) nomem();
++ if (!stralloc_0(&tai)) nomem();
++
++ if (!stralloc_copy(&tmp,&tai)) nomem();
++ while (tmp.len < field[1])
++ if (!stralloc_cats(&tmp," ")) nomem();
++ if (!stralloc_cats(&tmp,line.s + field[1])) nomem();
++ if (!stralloc_copy(&line,&tmp)) nomem();
++ if (!stralloc_0(&line)) nomem();
++ }
++
+ void main()
+ {
+ int i;
+***************
+*** 452,457 ****
+--- 493,500 ----
+ while (j < line.len) if (!line.s[j]) break; else ++j;
+ }
+ if (!stralloc_0(&line)) nomem();
++
++ if ((line.s[field[0]]) == '@') fix_taia();
+
+ if (str_equal(line.s + field[1],"status:")) ;
+ else if (str_equal(line.s + field[1],"starting")) starting();