1{ stdenv, fetchFromGitHub, 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 = [
23 git
24 (python2Packages.python.withPackages
25 (p: with p; [ setuptools tornado ]
26 ++ stdenv.lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl fuse ]))
27 ];
28 nativeBuildInputs = [ pandoc perl makeWrapper ];
29
30 postPatch = ''
31 patchShebangs .
32 substituteInPlace Makefile --replace "-Werror" ""
33 substituteInPlace Makefile --replace "./format-subst.pl" "${perl}/bin/perl ./format-subst.pl"
34 '' + optionalString par2Support ''
35 substituteInPlace cmd/fsck-cmd.py --replace "['par2'" "['${par2cmdline}/bin/par2'"
36 '';
37
38 dontAddPrefix = true;
39
40 makeFlags = [
41 "MANDIR=$(out)/share/man"
42 "DOCDIR=$(out)/share/doc/bup"
43 "BINDIR=$(out)/bin"
44 "LIBDIR=$(out)/lib/bup"
45 ];
46
47 postInstall = ''
48 wrapProgram $out/bin/bup \
49 --prefix PATH : ${git}/bin
50 '';
51
52 meta = {
53 homepage = https://github.com/bup/bup;
54 description = "Efficient file backup system based on the git packfile format";
55 license = licenses.gpl2Plus;
56
57 longDescription = ''
58 Highly efficient file backup system based on the git packfile format.
59 Capable of doing *fast* incremental backups of virtual machine images.
60 '';
61
62 platforms = platforms.linux ++ platforms.darwin;
63 maintainers = with maintainers; [ muflax ];
64 };
65}