diff options
author | Badi' Abdul-Wahid <abdulwahidc@gmail.com> | 2016-01-16 00:16:56 -0500 |
---|---|---|
committer | Badi' Abdul-Wahid <abdulwahidc@gmail.com> | 2016-02-01 19:59:03 -0500 |
commit | 1cf106dd06d9be7df330013d5d4835317e61630a (patch) | |
tree | fd9fd75398030006d2a916c35f5d71dbb6be3499 /pkgs/tools/text/popfile | |
parent | eeb3600e55649f143291aafcf86538f43f517f4f (diff) |
popfile: init at 1.1.3
Popfile by default assumes that it is run directly from the install directory, in which it has full write access. This assumption is invalid on Nix, and so Popfile is pachted to accomodate this: - define `POPFILE_ROOT` in wrapper Default POPFile configuration assumes it is running in the installation directory. This patch wraps `popfile.pl` so that `POPFILE_ROOT` points to the installation directory - define and create if missing `POPFILE_USER` in wrapper POPFile stores stores state in the `POPFILE_USER` directory, which by default is the installation directory. This change sets `POPFILE_USER` to `$HOME/.popfile` by default, creating it with 0700 mode if necessary.
Diffstat (limited to 'pkgs/tools/text/popfile')
-rw-r--r-- | pkgs/tools/text/popfile/default.nix | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/tools/text/popfile/default.nix b/pkgs/tools/text/popfile/default.nix new file mode 100644 index 0000000000000..3310c1a2fe4ac --- /dev/null +++ b/pkgs/tools/text/popfile/default.nix @@ -0,0 +1,71 @@ +{ stdenv, fetchzip, makeWrapper, perlPackages, +... }: + +stdenv.mkDerivation rec { + appname = "popfile"; + version = "1.1.3"; + name = "${appname}-${version}"; + + src = fetchzip { + url = "http://getpopfile.org/downloads/${appname}-${version}.zip"; + sha256 = "0gcib9j7zxk8r2vb5dbdz836djnyfza36vi8215nxcdfx1xc7l63"; + stripRoot = false; + }; + + buildInputs = [ makeWrapper ] ++ (with perlPackages; [ + ## These are all taken from the popfile documentation as applicable to Linux + ## http://getpopfile.org/docs/howtos:allplatformsrequireperl + perl + DBI + DBDSQLite + Digest + DigestMD5 + HTMLTagset + MIMEBase64 # == MIMEQuotedPrint + TimeDate # == DateParse + HTMLTemplate + # IO::Socket::Socks is not in nixpkgs + # IOSocketSocks + IOSocketSSL + NetSSLeay + SOAPLite + ]); + + + phases = [ "unpackPhase" "installPhase" "patchPhase" "postInstall" ]; + + installPhase = '' + mkdir -p $out/bin + # I user `cd` rather than `cp $out/* ...` b/c the * breaks syntax + # highlighting in emacs for me. + cd $src + cp -r * $out/bin + cd $out/bin + chmod +x *.pl + ''; + + patchPhase = "patchShebangs $out"; + + postInstall = '' + find $out -name '*.pl' -executable | while read path; do + wrapProgram "$path" \ + --prefix PERL5LIB : $PERL5LIB:$out/bin \ + --set POPFILE_ROOT $out/bin \ + --set POPFILE_USER \$\{POPFILE_USER:-\$HOME/.popfile\} \ + --run "test -d \$POPFILE_USER || mkdir -m 0700 -p \$POPFILE_USER" + done + ''; + + meta = { + description = "An email classification system that automatically sorts messages and fights spam."; + homepage = http://getpopfile.org; + license = stdenv.lib.licenses.gpl2; + + # Should work on OS X, but havent tested it. + # Windows support is more complicated. + # http://getpopfile.org/docs/faq:systemrequirements + platforms = stdenv.lib.platforms.linux; + }; + +} + |