1{ stdenv, fetchFromGitHub, fetchurl, makeWrapper
2, perl, pandoc, python2Packages, git
3, par2cmdline ? null, par2Support ? true
4}:
5
6assert par2Support -> par2cmdline != null;
7
8let version = "0.29.1"; 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 = "0wdr399jf64zzzsdvldhrwvnh5xpbghjvslr1j2cwr5y4i36znxf";
20 };
21
22 buildInputs = [ git python2Packages.python ];
23 nativeBuildInputs = [ pandoc perl makeWrapper ];
24
25 postPatch = ''
26 patchShebangs .
27 substituteInPlace Makefile --replace "-Werror" ""
28 substituteInPlace Makefile --replace "./format-subst.pl" "${perl}/bin/perl ./format-subst.pl"
29 '' + optionalString par2Support ''
30 substituteInPlace cmd/fsck-cmd.py --replace "['par2'" "['${par2cmdline}/bin/par2'"
31 '';
32
33 dontAddPrefix = true;
34
35 makeFlags = [
36 "MANDIR=$(out)/share/man"
37 "DOCDIR=$(out)/share/doc/bup"
38 "BINDIR=$(out)/bin"
39 "LIBDIR=$(out)/lib/bup"
40 ];
41
42 postInstall = ''
43 wrapProgram $out/bin/bup \
44 --prefix PATH : ${git}/bin \
45 --prefix PYTHONPATH : ${concatStringsSep ":" (map (x: "$(toPythonPath ${x})")
46 (with python2Packages;
47 [ setuptools tornado ]
48 ++ stdenv.lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl 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 = 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 platforms = platforms.linux ++ platforms.darwin;
62 maintainers = with maintainers; [ muflax ];
63 };
64}