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