1{ lib, stdenv, fetchFromGitHub, makeWrapper
2, perl, pandoc, python3, git
3, par2cmdline ? null, par2Support ? true
4}:
5
6assert par2Support -> par2cmdline != null;
7
8let
9 version = "0.33.2";
10
11 pythonDeps = with python3.pkgs; [ setuptools tornado ]
12 ++ lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl fuse ];
13in
14
15stdenv.mkDerivation {
16 pname = "bup";
17 inherit version;
18
19 src = fetchFromGitHub {
20 repo = "bup";
21 owner = "bup";
22 rev = version;
23 hash = "sha256-DDVCrY4SFqzKukXm8rIq90xAW2U+yYyhyPmUhslMMWI=";
24 };
25
26 buildInputs = [ git python3 ];
27 nativeBuildInputs = [ pandoc perl makeWrapper ];
28
29 postPatch = "patchShebangs .";
30
31 dontAddPrefix = true;
32
33 makeFlags = [
34 "MANDIR=$(out)/share/man"
35 "DOCDIR=$(out)/share/doc/bup"
36 "BINDIR=$(out)/bin"
37 "LIBDIR=$(out)/lib/bup"
38 ];
39
40 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-error=implicit-function-declaration";
41
42 postInstall = ''
43 wrapProgram $out/bin/bup \
44 --prefix PATH : ${lib.makeBinPath [ git par2cmdline ]} \
45 --prefix NIX_PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3.sitePackages pythonDeps}
46 '';
47
48 meta = with lib; {
49 homepage = "https://github.com/bup/bup";
50 description = "Efficient file backup system based on the git packfile format";
51 license = licenses.gpl2Plus;
52
53 longDescription = ''
54 Highly efficient file backup system based on the git packfile format.
55 Capable of doing *fast* incremental backups of virtual machine images.
56 '';
57
58 platforms = platforms.linux ++ platforms.darwin;
59 maintainers = with maintainers; [ rnhmjoj ];
60 };
61}