1{ stdenv, fetchzip, fetchurl, python, pyxattr, pylibacl, setuptools
2, fuse, git, perl, pandoc, makeWrapper, par2cmdline, par2Support ? false }:
3
4assert par2Support -> par2cmdline != null;
5
6let version = "0.26"; in
7
8with stdenv.lib;
9
10stdenv.mkDerivation rec {
11 name = "bup-${version}";
12
13 src = fetchzip {
14 url = "https://github.com/bup/bup/archive/${version}.tar.gz";
15 sha256 = "0g7b0xl3kg0z6rn81fvzl1xnvva305i7pjih2hm68mcj0adk3v0d";
16 };
17
18 buildInputs = [ python git ];
19 nativeBuildInputs = [ pandoc perl makeWrapper ];
20
21 darwin_10_10_patch = fetchurl {
22 url = "https://github.com/bup/bup/commit/75d089e7cdb7a7eb4d69c352f56dad5ad3aa1f97.diff";
23 sha256 = "05kp47p30a45ip0fg090vijvzc7ijr0alc3y8kjl6bvv3gliails";
24 };
25
26 postPatch = ''
27 patchShebangs .
28 substituteInPlace Makefile --replace "-Werror" ""
29 substituteInPlace Makefile --replace "./format-subst.pl" "perl ./format-subst.pl"
30 '' + optionalString par2Support ''
31 substituteInPlace cmd/fsck-cmd.py --replace "['par2'" "['${par2cmdline}/bin/par2'"
32 '' + optionalString (elem stdenv.system platforms.darwin) ''
33 patch -p1 < ${darwin_10_10_patch}
34 '';
35
36 dontAddPrefix = true;
37
38 makeFlags = [
39 "MANDIR=$(out)/share/man"
40 "DOCDIR=$(out)/share/doc/bup"
41 "BINDIR=$(out)/bin"
42 "LIBDIR=$(out)/lib/bup"
43 ];
44
45 postInstall = optionalString (elem stdenv.system platforms.linux) ''
46 wrapProgram $out/bin/bup --prefix PYTHONPATH : \
47 ${stdenv.lib.concatStringsSep ":"
48 (map (path: "$(toPythonPath ${path})") [ pyxattr pylibacl setuptools fuse ])}
49 '';
50
51 meta = {
52 homepage = "https://github.com/bup/bup";
53 description = "efficient file backup system based on the git packfile format";
54 license = stdenv.lib.licenses.gpl2Plus;
55
56 longDescription = ''
57 Highly efficient file backup system based on the git packfile format.
58 Capable of doing *fast* incremental backups of virtual machine images.
59 '';
60
61 hydraPlatforms = stdenv.lib.platforms.linux;
62 maintainers = with stdenv.lib.maintainers; [ muflax ];
63
64 };
65}