git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit1cf106dd06d9be7df330013d5d4835317e61630a authorBadi' Abdul-Wahid <abdulwahidc@gmail.com> dateSat 16 Jan 2016, 00:16 (11 years ago) parenteeb3600
2 files changed+73
pkgs/tools/text/popfile/default.nix+71 pkgs/top-level/all-packages.nix+2
pkgs/tools/text/popfile/default.nixnew file+71
@@ -0,0 +1,71 @@
1+{ stdenv, fetchzip, makeWrapper, perlPackages,
2+... }:
3+
4+stdenv.mkDerivation rec {
5+ appname = "popfile";
6+ version = "1.1.3";
7+ name = "${appname}-${version}";
8+
9+ src = fetchzip {
10+ url = "http://getpopfile.org/downloads/${appname}-${version}.zip";
11+ sha256 = "0gcib9j7zxk8r2vb5dbdz836djnyfza36vi8215nxcdfx1xc7l63";
12+ stripRoot = false;
13+ };
14+
15+ buildInputs = [ makeWrapper ] ++ (with perlPackages; [
16+ ## These are all taken from the popfile documentation as applicable to Linux
17+ ## http://getpopfile.org/docs/howtos:allplatformsrequireperl
18+ perl
19+ DBI
20+ DBDSQLite
21+ Digest
22+ DigestMD5
23+ HTMLTagset
24+ MIMEBase64 # == MIMEQuotedPrint
25+ TimeDate # == DateParse
26+ HTMLTemplate
27+ # IO::Socket::Socks is not in nixpkgs
28+ # IOSocketSocks
29+ IOSocketSSL
30+ NetSSLeay
31+ SOAPLite
32+ ]);
33+
34+
35+ phases = [ "unpackPhase" "installPhase" "patchPhase" "postInstall" ];
36+
37+ installPhase = ''
38+ mkdir -p $out/bin
39+ # I user `cd` rather than `cp $out/* ...` b/c the * breaks syntax
40+ # highlighting in emacs for me.
41+ cd $src
42+ cp -r * $out/bin
43+ cd $out/bin
44+ chmod +x *.pl
45+ '';
46+
47+ patchPhase = "patchShebangs $out";
48+
49+ postInstall = ''
50+ find $out -name '*.pl' -executable | while read path; do
51+ wrapProgram "$path" \
52+ --prefix PERL5LIB : $PERL5LIB:$out/bin \
53+ --set POPFILE_ROOT $out/bin \
54+ --set POPFILE_USER \$\{POPFILE_USER:-\$HOME/.popfile\} \
55+ --run "test -d \$POPFILE_USER || mkdir -m 0700 -p \$POPFILE_USER"
56+ done
57+ '';
58+
59+ meta = {
60+ description = "An email classification system that automatically sorts messages and fights spam.";
61+ homepage = http://getpopfile.org;
62+ license = stdenv.lib.licenses.gpl2;
63+
64+ # Should work on OS X, but havent tested it.
65+ # Windows support is more complicated.
66+ # http://getpopfile.org/docs/faq:systemrequirements
67+ platforms = stdenv.lib.platforms.linux;
68+ };
69+
70+}
71+
pkgs/top-level/all-packages.nix+2
@@ -2824,6 +2824,8 @@ let
28242824
28252825 ponysay = callPackage ../tools/misc/ponysay { };
28262826
2827+ popfile = callPackage ../tools/text/popfile { };
2828+
28272829 povray = callPackage ../tools/graphics/povray {
28282830 automake = automake113x; # fails with 14
28292831 };