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
10stdenv.mkDerivation {
11 pname = "bup";
12 inherit version;
13
14 src = fetchFromGitHub {
15 repo = "bup";
16 owner = "bup";
17 rev = version;
18 sha256 = "sha256-SWnEJ5jwu/Jr2NLsTS8ajWay0WX/gYbOc3J6w00DndI=";
19 };
20
21 buildInputs = [
22 git
23 (python3Packages.python.withPackages
24 (p: with p; [ setuptools tornado ]
25 ++ lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl fuse ]))
26 ];
27 nativeBuildInputs = [ pandoc perl makeWrapper ];
28
29 postPatch = ''
30 patchShebangs .
31 substituteInPlace Makefile --replace "-Werror" ""
32 '' + lib.optionalString par2Support ''
33 substituteInPlace cmd/fsck-cmd.py --replace "'par2'" "'${par2cmdline}/bin/par2'"
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 = ''
46 wrapProgram $out/bin/bup \
47 --prefix PATH : ${git}/bin
48 '';
49
50 meta = with lib; {
51 homepage = "https://github.com/bup/bup";
52 description = "Efficient file backup system based on the git packfile format";
53 license = licenses.gpl2Plus;
54
55 longDescription = ''
56 Highly efficient file backup system based on the git packfile format.
57 Capable of doing *fast* incremental backups of virtual machine images.
58 '';
59
60 platforms = platforms.linux ++ platforms.darwin;
61 maintainers = with maintainers; [ ];
62 };
63}