1{ lib, stdenv, fetchFromGitHub, makeWrapper
2, perl, pandoc, python3Packages, git
3, par2cmdline ? null, par2Support ? true
4}:
5
6assert par2Support -> par2cmdline != null;
7
8let version = "0.32"; in
9
10with lib;
11
12stdenv.mkDerivation {
13 pname = "bup";
14 inherit version;
15
16 src = fetchFromGitHub {
17 repo = "bup";
18 owner = "bup";
19 rev = version;
20 sha256 = "sha256-SWnEJ5jwu/Jr2NLsTS8ajWay0WX/gYbOc3J6w00DndI=";
21 };
22
23 buildInputs = [
24 git
25 (python3Packages.python.withPackages
26 (p: with p; [ setuptools tornado ]
27 ++ lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl fuse ]))
28 ];
29 nativeBuildInputs = [ pandoc perl makeWrapper ];
30
31 postPatch = ''
32 patchShebangs .
33 substituteInPlace Makefile --replace "-Werror" ""
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}