1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeWrapper,
6 perl,
7 pandoc,
8 python3,
9 git,
10
11 par2Support ? true,
12 par2cmdline ? null,
13}:
14
15assert par2Support -> par2cmdline != null;
16
17let
18 version = "0.33.7";
19
20 pythonDeps =
21 with python3.pkgs;
22 [
23 setuptools
24 tornado
25 ]
26 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
27 pyxattr
28 pylibacl
29 fuse
30 ];
31in
32
33stdenv.mkDerivation {
34 pname = "bup";
35 inherit version;
36
37 src = fetchFromGitHub {
38 repo = "bup";
39 owner = "bup";
40 rev = version;
41 hash = "sha256-tuOUml4gF4i7bE2xtjJJol1gRAfYv73RghUYwIDsGyM=";
42 };
43
44 buildInputs = [
45 python3
46 ];
47 nativeBuildInputs = [
48 pandoc
49 perl
50 makeWrapper
51 ];
52
53 configurePlatforms = [ ];
54
55 postPatch = ''
56 patchShebangs --build .
57 substituteInPlace ./config/configure \
58 --replace-fail 'bup_git=' 'bup_git="${lib.getExe git}" #'
59 '';
60
61 dontAddPrefix = true;
62
63 makeFlags = [
64 "MANDIR=$(out)/share/man"
65 "DOCDIR=$(out)/share/doc/bup"
66 "BINDIR=$(out)/bin"
67 "LIBDIR=$(out)/lib/bup"
68 ];
69
70 env.BUP_PYTHON_CONFIG = lib.getExe' (lib.getDev python3) "python-config";
71 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration -Wno-error=implicit-int";
72
73 postInstall = ''
74 wrapProgram $out/bin/bup \
75 --prefix PATH : ${
76 lib.makeBinPath [
77 git
78 par2cmdline
79 ]
80 } \
81 --prefix NIX_PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3.sitePackages pythonDeps}
82 '';
83
84 meta = with lib; {
85 homepage = "https://github.com/bup/bup";
86 description = "Efficient file backup system based on the git packfile format";
87 mainProgram = "bup";
88 license = licenses.gpl2Plus;
89
90 longDescription = ''
91 Highly efficient file backup system based on the git packfile format.
92 Capable of doing *fast* incremental backups of virtual machine images.
93 '';
94
95 platforms = platforms.linux ++ platforms.darwin;
96 maintainers = with maintainers; [ rnhmjoj ];
97 # bespoke ./configure does not like cross
98 broken = stdenv.buildPlatform != stdenv.hostPlatform;
99 };
100}