gnu: Add emacs-amx.
[jackhill/guix/guix.git] / gnu / packages / backup.scm
CommitLineData
d1a5439b 1;;; GNU Guix --- Functional package management for GNU
aa90f2cd 2;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
29a7c98a 3;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
d265169b 4;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name>
fb6112e9 5;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
0da4f365 6;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
a2fa9c3d 7;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
3c8ba11a 8;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
4ac8d486 9;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
0ff4425c 10;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
44dd001d 11;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
1a3aa5ba 12;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
f77886c1 13;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
1e957fab 14;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
c824dedf 15;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
d1a5439b
EB
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages backup)
33 #:use-module (guix packages)
b5b73a82 34 #:use-module ((guix licenses) #:prefix license:)
5cdbdc2b 35 #:use-module (guix git-download)
d1a5439b 36 #:use-module (guix download)
29a7c98a 37 #:use-module (guix utils)
2d762953 38 #:use-module (guix build-system gnu)
f77886c1 39 #:use-module (guix build-system go)
d1a5439b
EB
40 #:use-module (guix build-system python)
41 #:use-module (gnu packages)
0c146750 42 #:use-module (gnu packages acl)
f6875394 43 #:use-module (gnu packages autotools)
2d762953 44 #:use-module (gnu packages base)
ac257f12 45 #:use-module (gnu packages check)
2d762953 46 #:use-module (gnu packages compression)
19278d8d 47 #:use-module (gnu packages crypto)
362f496d 48 #:use-module (gnu packages databases)
7b9b203a 49 #:use-module (gnu packages datastructures)
255d1bbe 50 #:use-module (gnu packages dbm)
d42e6122 51 #:use-module (gnu packages dejagnu)
2903ee1e 52 #:use-module (gnu packages ftp)
2d762953 53 #:use-module (gnu packages glib)
d1a5439b 54 #:use-module (gnu packages gnupg)
f77886c1 55 #:use-module (gnu packages golang)
362f496d
LC
56 #:use-module (gnu packages gperf)
57 #:use-module (gnu packages guile)
335bc683 58 #:use-module (gnu packages linux)
2d762953 59 #:use-module (gnu packages mcrypt)
d42e6122
EB
60 #:use-module (gnu packages nettle)
61 #:use-module (gnu packages pcre)
0da4f365 62 #:use-module (gnu packages perl)
2d762953 63 #:use-module (gnu packages pkg-config)
0c146750 64 #:use-module (gnu packages python)
cc6f4912 65 #:use-module (gnu packages python-crypto)
1b2f753d 66 #:use-module (gnu packages python-web)
44d10b1f 67 #:use-module (gnu packages python-xyz)
d1a5439b 68 #:use-module (gnu packages rsync)
2d762953 69 #:use-module (gnu packages ssh)
0c146750 70 #:use-module (gnu packages tls)
29a7c98a 71 #:use-module (gnu packages xml))
d1a5439b
EB
72
73(define-public duplicity
74 (package
75 (name "duplicity")
7bb7920f 76 (version "0.7.18.1")
d1a5439b
EB
77 (source
78 (origin
79 (method url-fetch)
80 (uri (string-append "https://code.launchpad.net/duplicity/"
29a7c98a 81 (version-major+minor version)
d1a5439b
EB
82 "-series/" version "/+download/duplicity-"
83 version ".tar.gz"))
84 (sha256
85 (base32
7bb7920f 86 "17c0203y5qz9w8iyhs26l44qf6a1vp26b5ykz1ypdr2kv6g02df9"))))
d1a5439b
EB
87 (build-system python-build-system)
88 (native-inputs
02489a66 89 `(("util-linux" ,util-linux) ; setsid command, for the tests
8ef8de79 90 ("par2cmdline" ,par2cmdline)
2903ee1e 91 ("python-pexpect" ,python2-pexpect)
2dfb9bbf 92 ("python-fasteners" ,python2-fasteners)
2903ee1e
TD
93 ("mock" ,python2-mock)))
94 (propagated-inputs
95 `(("lockfile" ,python2-lockfile)
96 ("urllib3" ,python2-urllib3)))
d1a5439b 97 (inputs
2903ee1e
TD
98 `(("librsync" ,librsync)
99 ("lftp" ,lftp)
02489a66
TGR
100 ("gnupg" ,gnupg) ; gpg executable needed
101 ("util-linux" ,util-linux) ; for setsid
335bc683 102 ("tzdata" ,tzdata)))
d1a5439b 103 (arguments
02489a66 104 `(#:python ,python-2 ; setup assumes Python 2
d1a5439b 105 #:test-target "test"
ad04bd6b
MB
106 #:phases
107 (modify-phases %standard-phases
7bb7920f 108 (add-before 'build 'use-store-file-names
ad04bd6b 109 (lambda* (#:key inputs #:allow-other-keys)
8ef8de79
MB
110 (substitute* "duplicity/gpginterface.py"
111 (("self.call = 'gpg'")
112 (string-append "self.call = '" (assoc-ref inputs "gnupg") "/bin/gpg'")))
e61f092c 113
8ef8de79
MB
114 (substitute* '("testing/functional/__init__.py"
115 "testing/overrides/bin/lftp")
ad04bd6b 116 (("/bin/sh") (which "sh")))
8ef8de79
MB
117 #t))
118 (add-before 'check 'check-setup
119 (lambda* (#:key inputs #:allow-other-keys)
02489a66
TGR
120 (setenv "HOME" (getcwd)) ; gpg needs to write to $HOME
121 (setenv "TZDIR" ; some timestamp checks need TZDIR
ad04bd6b
MB
122 (string-append (assoc-ref inputs "tzdata")
123 "/share/zoneinfo"))
124 #t)))))
d1a5439b
EB
125 (home-page "http://duplicity.nongnu.org/index.html")
126 (synopsis "Encrypted backup using rsync algorithm")
127 (description
128 "Duplicity backs up directories by producing encrypted tar-format volumes
129and uploading them to a remote or local file server. Because duplicity uses
130librsync, the incremental archives are space efficient and only record the
131parts of files that have changed since the last backup. Because duplicity
132uses GnuPG to encrypt and/or sign these archives, they will be safe from
133spying and/or modification by the server.")
b0e3635e 134 (license license:gpl2+)))
2d762953 135
f6875394
BT
136(define-public par2cmdline
137 (package
138 (name "par2cmdline")
44dd001d 139 (version "0.8.0")
f6875394 140 (source (origin
5cdbdc2b
RW
141 (method git-fetch)
142 (uri (git-reference
143 (url "https://github.com/Parchive/par2cmdline.git")
144 (commit (string-append "v" version))))
145 (file-name (git-file-name name version))
f6875394
BT
146 (sha256
147 (base32
5cdbdc2b 148 "0f1jsd5sw2wynjzi7yjqjaf13yhyjfdid91p8yh0jn32y03kjyrz"))))
f6875394
BT
149 (native-inputs
150 `(("automake" ,automake)
151 ("autoconf" ,autoconf)))
152 (build-system gnu-build-system)
f6d59ecf
TGR
153 (synopsis "File verification and repair tools")
154 (description "Par2cmdline uses Reed-Solomon error-correcting codes to
155generate and verify PAR2 recovery files. These files can be distributed
156alongside the source files or stored together with back-ups to protect against
157transmission errors or @dfn{bit rot}, the degradation of storage media over
158time.
159Unlike a simple checksum, PAR2 doesn't merely detect errors: as long as the
a2dd9270
TGR
160damage isn't too extensive (and smaller than the size of the recovery file), it
161can even repair them.")
f6875394
BT
162 (home-page "https://github.com/Parchive/par2cmdline")
163 (license license:gpl3+)))
164
2d762953
EB
165(define-public hdup
166 (package
167 (name "hdup")
168 (version "2.0.14")
169 (source
170 (origin
171 (method url-fetch)
35d28c60 172 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
2d762953
EB
173 (sha256
174 (base32
175 "02bnczg01cyhajmm4rhbnc0ja0dd9ikv9fwv28asxh1rlx9yr0b7"))))
176 (build-system gnu-build-system)
177 (native-inputs `(("pkg-config" ,pkg-config)))
178 (inputs
179 `(("glib" ,glib)
180 ("tar" ,tar)
181 ("lzop" ,lzop)
182 ("mcrypt" ,mcrypt)
183 ("openssh" ,openssh)
184 ("gnupg" ,gnupg-1)))
185 (arguments
186 `(#:configure-flags
187 `(,(string-append "--sbindir=" (assoc-ref %outputs "out") "/bin"))
188 #:tests? #f))
189 (home-page "http://archive.miek.nl/projects/hdup/index.html")
190 (synopsis "Simple incremental backup tool")
191 (description
69b4ffcf 192 "Hdup2 is a backup utility, its aim is to make backup really simple. The
2d762953
EB
193backup scheduling is done by means of a cron job. It supports an
194include/exclude mechanism, remote backups, encrypted backups and split
195backups (called chunks) to allow easy burning to CD/DVD.")
b0e3635e
LC
196 (license license:gpl2)))
197
198(define-public libarchive
199 (package
200 (name "libarchive")
c824dedf 201 (replacement libarchive-3.3.3)
7095760c 202 (version "3.3.2")
b0e3635e
LC
203 (source
204 (origin
205 (method url-fetch)
c824dedf 206 (uri (string-append "https://libarchive.org/downloads/libarchive-"
b0e3635e 207 version ".tar.gz"))
f76fc968
LF
208 (patches (search-patches "libarchive-CVE-2017-14166.patch"
209 "libarchive-CVE-2017-14502.patch"))
b0e3635e
LC
210 (sha256
211 (base32
7095760c 212 "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd"))))
b0e3635e
LC
213 (build-system gnu-build-system)
214 (inputs
215 `(("zlib" ,zlib)
216 ("nettle" ,nettle)
217 ("lzo" ,lzo)
218 ("bzip2" ,bzip2)
219 ("libxml2" ,libxml2)
220 ("xz" ,xz)))
221 (arguments
222 `(#:phases
4ac8d486
EF
223 (modify-phases %standard-phases
224 (add-before 'build 'patch-pwd
225 (lambda _
226 (substitute* "Makefile"
6266b8bc
EF
227 (("/bin/pwd") (which "pwd")))
228 #t))
4ac8d486
EF
229 (replace 'check
230 (lambda _
231 ;; XXX: The test_owner_parse, test_read_disk, and
232 ;; test_write_disk_lookup tests expect user 'root' to exist, but
233 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
234 ;;
235 ;; The tests allow one to disable tests matching a globbing pattern.
1a3aa5ba
MW
236 (invoke "make" "libarchive_test" "bsdcpio_test" "bsdtar_test")
237 ;; XXX: This glob disables too much.
238 (invoke "./libarchive_test" "^test_*_disk*")
239 (invoke "./bsdcpio_test" "^test_owner_parse")
5294836d
LC
240 (invoke "./bsdtar_test")))
241 (add-after 'install 'add--L-in-libarchive-pc
242 (lambda* (#:key inputs outputs #:allow-other-keys)
243 (let* ((out (assoc-ref outputs "out"))
244 (lib (string-append out "/lib"))
245 (nettle (assoc-ref inputs "nettle"))
246 (libxml2 (assoc-ref inputs "libxml2"))
247 (xz (assoc-ref inputs "xz"))
248 (zlib (assoc-ref inputs "zlib"))
249 (bzip2 (assoc-ref inputs "bzip2")))
250 (substitute* (string-append lib "/pkgconfig/libarchive.pc")
251 (("-lnettle")
252 (string-append "-L" nettle "/lib -lnettle"))
253 (("-lxml2")
254 (string-append "-L" libxml2 "/lib -lxml2"))
255 (("-llzma")
256 (string-append "-L" xz "/lib -llzma"))
257 (("-lz")
258 (string-append "-L" zlib "/lib -lz"))
259 (("-lbz2")
260 (string-append "-L" bzip2 "/lib -lbz2")))
261 #t))))
262
09cbd53c
EF
263 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
264 ;; compiled with C99 or C11 or a gnu variant.
265 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
c824dedf 266 (home-page "https://libarchive.org/")
b0e3635e
LC
267 (synopsis "Multi-format archive and compression library")
268 (description
269 "Libarchive provides a flexible interface for reading and writing
270archives in various formats such as tar and cpio. Libarchive also supports
271reading and writing archives compressed using various compression filters such
272as gzip and bzip2. The library is inherently stream-oriented; readers
273serially iterate through the archive, writers serially add things to the
35b9e423 274archive. In particular, note that there is currently no built-in support for
b0e3635e
LC
275random access nor for in-place modification.")
276 (license license:bsd-2)))
d42e6122 277
c824dedf
AV
278(define-public libarchive-3.3.3
279 (package
280 (inherit libarchive)
281 (version "3.3.3")
282 (source
283 (origin
284 (method url-fetch)
285 (uri (string-append "https://libarchive.org/downloads/libarchive-"
286 version ".tar.gz"))
287 (patches (search-patches "libarchive-CVE-2018-1000877.patch"
288 "libarchive-CVE-2018-1000878.patch"
289 "libarchive-CVE-2018-1000880.patch"))
290 (sha256
291 (base32
292 "0bhfncid058p7n1n8v29l6wxm3mhdqfassscihbsxfwz3iwb2zms"))))))
293
d42e6122
EB
294(define-public rdup
295 (package
296 (name "rdup")
fbf210cb 297 (version "1.1.15")
d42e6122
EB
298 (source
299 (origin
300 (method url-fetch)
fbf210cb
TGR
301 (file-name (string-append name "-" version ".tar.gz"))
302 (uri (string-append "https://github.com/miekg/rdup/archive/"
303 version ".tar.gz"))
d42e6122
EB
304 (sha256
305 (base32
fbf210cb 306 "1jr91hgcf0rrpanqlwws72ql9db6d6grs2i122ki1s4bx0vqqyvq"))))
d42e6122
EB
307 (build-system gnu-build-system)
308 (native-inputs
fbf210cb
TGR
309 `(("autoconf" ,autoconf)
310 ("automake" ,automake)
311 ("pkg-config" ,pkg-config)
312
313 ;; For tests.
d42e6122
EB
314 ("dejagnu" ,dejagnu)))
315 (inputs
316 `(("glib" ,glib)
317 ("pcre" ,pcre)
318 ("libarchive" ,libarchive)
fbf210cb 319 ("mcrypt" ,mcrypt)
d42e6122
EB
320 ("nettle" ,nettle)))
321 (arguments
322 `(#:parallel-build? #f ;race conditions
dc1d3cde
KK
323 #:phases
324 (modify-phases %standard-phases
fbf210cb
TGR
325 (add-before 'build 'qualify-inputs
326 (lambda* (#:key inputs #:allow-other-keys)
327 ;; This script is full of pitfalls. Fix some that particularly
328 ;; affect Guix users & leave the rest as reader excercises.
329 (substitute* "rdup-simple"
330 ;; Use the input ‘mcrypt’, not whatever's in $PATH at run time.
331 (("([' ])mcrypt " all delimiter)
332 (string-append delimiter (which "mcrypt") " "))
333 ;; Avoid frivolous dependency on ‘which’ with a shell builtin.
334 (("which") "command -v"))
dc1d3cde
KK
335 #t))
336 (add-before 'check 'pre-check
337 (lambda _
338 (setenv "HOME" (getcwd))
339 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
340 (("/bin/cat") (which "cat")))
341 #t)))))
fbf210cb 342 (home-page "https://github.com/miekg/rdup")
d42e6122
EB
343 (synopsis "Provide a list of files to backup")
344 (description
345 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
346Rdup itself does not backup anything, it only print a list of absolute
e881752c 347file names to standard output. Auxiliary scripts are needed that act on this
d42e6122 348list and implement the backup strategy.")
b0e3635e 349 (license license:gpl3+)))
22c24621
EB
350
351(define-public btar
352 (package
353 (name "btar")
354 (version "1.1.1")
355 (source
356 (origin
357 (method url-fetch)
358 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
359 "btar-" version ".tar.gz"))
360 (sha256
361 (base32
362 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
363 (build-system gnu-build-system)
364 (inputs
365 `(("librsync" ,librsync)))
366 (arguments
367 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
368 "CC=gcc")
369 #:tests? #f ;test input not distributed
370 #:phases
dc1d3cde
KK
371 ;; no configure phase
372 (modify-phases %standard-phases
373 (delete 'configure))))
22c24621
EB
374 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
375 (synopsis "Tar-compatible archiver")
376 (description
377 "Btar is a tar-compatible archiver which allows arbitrary compression and
378ciphering, redundancy, differential backup, indexed extraction, multicore
379compression, input and output serialisation, and tolerance to partial archive
380errors.")
b0e3635e 381 (license license:gpl3+)))
bd3fc08c
EB
382
383(define-public rdiff-backup
384 (package
385 (name "rdiff-backup")
386 (version "1.2.8")
387 (source
388 (origin
389 (method url-fetch)
390 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
391 version ".tar.gz"))
392 (sha256
393 (base32
394 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
395 (build-system python-build-system)
bd3fc08c
EB
396 (inputs
397 `(("python" ,python-2)
398 ("librsync" ,librsync)))
399 (arguments
400 `(#:python ,python-2
401 #:tests? #f))
340978d7 402 (home-page "https://www.nongnu.org/rdiff-backup/")
bd3fc08c
EB
403 (synopsis "Local/remote mirroring+incremental backup")
404 (description
405 "Rdiff-backup backs up one directory to another, possibly over a network.
406The target directory ends up a copy of the source directory, but extra reverse
407diffs are stored in a special subdirectory of that target directory, so you
408can still recover files lost some time ago. The idea is to combine the best
409features of a mirror and an incremental backup. Rdiff-backup also preserves
410subdirectories, hard links, dev files, permissions, uid/gid ownership,
411modification times, extended attributes, acls, and resource forks. Also,
412rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
413rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
414to a remote location, and only the differences will be transmitted. Finally,
e881752c 415rdiff-backup is easy to use and settings have sensible defaults.")
b0e3635e 416 (license license:gpl2+)))
0c146750 417
0da4f365
TD
418(define-public rsnapshot
419 (package
420 (name "rsnapshot")
421 (version "1.4.2")
422 (source
423 (origin
424 (method url-fetch)
425 (uri (string-append
426 "https://github.com/rsnapshot/rsnapshot/releases/download/"
427 version "/rsnapshot-" version ".tar.gz"))
428 (sha256
429 (base32
430 "05jfy99a0xs6lvsjfp3wz21z0myqhmwl2grn3jr9clijbg282ah4"))))
431 (build-system gnu-build-system)
432 (arguments
433 `(#:phases
434 (modify-phases %standard-phases
435 (replace 'check
436 (lambda _
437 (substitute* '("t/cmd-post_pre-exec/conf/pre-true-post-true.conf"
438 "t/backup_exec/conf/backup_exec_fail.conf"
439 "t/backup_exec/conf/backup_exec.conf")
440 (("/bin/true") (which "true"))
441 (("/bin/false") (which "false")))
4ce7c1b3 442 (invoke "make" "test"))))))
0da4f365
TD
443 (inputs
444 `(("perl" ,perl)
445 ("rsync" ,rsync)))
446 (home-page "http://rsnapshot.org")
447 (synopsis "Deduplicating snapshot backup utility based on rsync")
162a1374 448 (description "rsnapshot is a file system snapshot utility based on rsync.
0da4f365
TD
449rsnapshot makes it easy to make periodic snapshots of local machines, and
450remote machines over SSH. To reduce the disk space required for each backup,
451rsnapshot uses hard links to deduplicate identical files.")
452 (license license:gpl2+)))
453
362f496d
LC
454(define-public libchop
455 (package
456 (name "libchop")
457 (version "0.5.2")
458 (source (origin
459 (method url-fetch)
460 (uri (string-append "mirror://savannah/libchop/libchop-"
461 version ".tar.gz"))
462 (sha256
463 (base32
464 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
fc1adab1 465 (patches (search-patches "diffutils-gets-undeclared.patch"))))
362f496d 466 (build-system gnu-build-system)
6d1a7ce8
LC
467 (arguments
468 '(#:phases (modify-phases %standard-phases
469 (add-before 'configure 'adjust-configure-script
470 (lambda _
471 ;; Mimic upstream commit
472 ;; 25750ab5ef82fd3cfce5205d5f1ef07b47098091.
473 (substitute* "configure"
474 (("GUILE=(.*)--variable bindir`" _ middle)
475 (string-append "GUILE=" middle
476 "--variable bindir`/guile")))
477 #t))
478 (add-before 'check 'skip-test
479 (lambda _
480 ;; XXX: This test fails (1) because current GnuTLS no
481 ;; longer supports OpenPGP authentication, and (2) for
482 ;; some obscure reason. Better skip it.
483 (setenv "XFAIL_TESTS" "utils/block-server")
484 #t)))))
362f496d
LC
485 (native-inputs
486 `(("guile" ,guile-2.0)
c9f898cd 487 ("gperf" ,gperf-3.0) ;see <https://bugs.gnu.org/32382>
362f496d
LC
488 ("pkg-config" ,pkg-config)))
489 (inputs
490 `(("guile" ,guile-2.0)
491 ("util-linux" ,util-linux)
492 ("gnutls" ,gnutls)
493 ("tdb" ,tdb)
494 ("bdb" ,bdb)
495 ("gdbm" ,gdbm)
496 ("libgcrypt" ,libgcrypt)
497 ("lzo" ,lzo)
498 ("bzip2" ,bzip2)
499 ("zlib" ,zlib)))
340978d7 500 (home-page "https://nongnu.org/libchop/")
362f496d
LC
501 (synopsis "Tools & library for data backup and distributed storage")
502 (description
503 "Libchop is a set of utilities and library for data backup and
504distributed storage. Its main application is @command{chop-backup}, an
505encrypted backup program that supports data integrity checks, versioning,
506distribution among several sites, selective sharing of stored data, adaptive
507compression, and more. The library itself implements storage techniques such
508as content-addressable storage, content hash keys, Merkle trees, similarity
509detection, and lossless compression.")
510 (license license:gpl3+)))
6fc5c11b
LF
511
512(define-public borg
513 (package
514 (name "borg")
e191e848 515 (version "1.1.9")
c4556777
TGR
516 (source
517 (origin
518 (method url-fetch)
519 (uri (pypi-uri "borgbackup" version))
520 (sha256
5a0696b2 521 (base32
e191e848 522 "0x95nhv4h34m8cxycbwc4xdz350saaxlgh727b23bgn4ci7gh3vx"))
c4556777
TGR
523 (modules '((guix build utils)))
524 (snippet
525 '(begin
5a3bf255
LF
526 ;; Delete files generated by Cython. We used to have a regex
527 ;; that created the list of generated files but Borg has
528 ;; added new non-generated C files that cause the regex to
529 ;; generate the wrong list.
c4556777 530 (for-each delete-file
5a3bf255
LF
531 '("src/borg/algorithms/checksums.c"
532 "src/borg/chunker.c"
533 "src/borg/compress.c"
534 "src/borg/crypto/low_level.c"
535 "src/borg/hashindex.c"
536 "src/borg/item.c"
537 "src/borg/platform/darwin.c"
538 "src/borg/platform/freebsd.c"
539 "src/borg/platform/linux.c"
540 "src/borg/platform/posix.c"))
c4556777
TGR
541 ;; Remove bundled shared libraries.
542 (with-directory-excursion "src/borg/algorithms"
543 (for-each delete-file-recursively
6cbee49d
MW
544 (list "blake2" "lz4" "zstd")))
545 #t))))
6fc5c11b
LF
546 (build-system python-build-system)
547 (arguments
c21b1a1f
LF
548 `(#:modules ((srfi srfi-26) ; for cut
549 (guix build utils)
550 (guix build python-build-system))
551 #:phases
6fc5c11b
LF
552 (modify-phases %standard-phases
553 (add-after 'unpack 'set-env
554 (lambda* (#:key inputs #:allow-other-keys)
555 (let ((openssl (assoc-ref inputs "openssl"))
19278d8d 556 (libb2 (assoc-ref inputs "libb2"))
c4556777
TGR
557 (lz4 (assoc-ref inputs "lz4"))
558 (zstd (assoc-ref inputs "zstd")))
6fc5c11b 559 (setenv "BORG_OPENSSL_PREFIX" openssl)
19278d8d 560 (setenv "BORG_LIBB2_PREFIX" libb2)
c4556777
TGR
561 (setenv "BORG_LIBLZ4_PREFIX" lz4)
562 (setenv "BORG_LIBZSTD_PREFIX" zstd)
6fc5c11b 563 (setenv "PYTHON_EGG_CACHE" "/tmp")
b4f91d0e
LF
564 ;; The test 'test_return_codes[python]' fails when
565 ;; HOME=/homeless-shelter.
566 (setenv "HOME" "/tmp")
6fc5c11b 567 #t)))
b4f91d0e
LF
568 ;; The tests need to be run after Borg is installed.
569 (delete 'check)
570 (add-after 'install 'check
1d60f7c2
LF
571 (lambda* (#:key inputs outputs #:allow-other-keys)
572 ;; Make the installed package available for the test suite.
573 (add-installed-pythonpath inputs outputs)
8cb3e7e7
LF
574 ;; The tests should be run in an empty directory.
575 (mkdir-p "tests")
576 (with-directory-excursion "tests"
e252ec32
TGR
577 (invoke "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
578 (string-append
579 ;; These tests need to write to '/var'.
580 "not test_get_cache_dir "
581 "and not test_get_config_dir "
582 "and not test_get_keys_dir "
583 "and not test_get_security_dir "
584 ;; These tests assume there is a root user in
585 ;; '/etc/passwd'.
586 "and not test_access_acl "
587 "and not test_default_acl "
588 "and not test_non_ascii_acl "
589 ;; This test needs the unpackaged pytest-benchmark.
590 "and not benchmark "
591 ;; These tests assume the kernel supports FUSE.
592 "and not test_fuse "
593 "and not test_fuse_allow_damaged_files "
594 "and not test_mount_hardlinks")))))
6fc5c11b 595 (add-after 'install 'install-doc
6ee4fd2a 596 (lambda* (#:key inputs outputs #:allow-other-keys)
6fc5c11b 597 (let* ((out (assoc-ref outputs "out"))
c21b1a1f
LF
598 (man (string-append out "/share/man/man1"))
599 (misc (string-append out "/share/borg/misc")))
600 (for-each (cut install-file <> misc)
601 '("docs/misc/create_chunker-params.txt"
602 "docs/misc/internals-picture.txt"
603 "docs/misc/prune-example.txt"))
e252ec32
TGR
604 (copy-recursively "docs/man" man)
605 #t))))))
6fc5c11b 606 (native-inputs
f99cfc19
EF
607 `(("python-cython" ,python-cython)
608 ("python-setuptools-scm" ,python-setuptools-scm)
d4c0053e 609 ("python-pytest" ,python-pytest)))
6fc5c11b
LF
610 (inputs
611 `(("acl" ,acl)
19278d8d 612 ("libb2" ,libb2)
6fc5c11b
LF
613 ("lz4" ,lz4)
614 ("openssl" ,openssl)
615 ("python-llfuse" ,python-llfuse)
acb59d99
LF
616 ;; The Python msgpack library changed its name so Borg requires this
617 ;; transitional package for now:
618 ;; <https://bugs.gnu.org/30662>
619 ("python-msgpack" ,python-msgpack-transitional)
c4556777 620 ("zstd" ,zstd)))
6fc5c11b
LF
621 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
622 (description "Borg is a deduplicating backup program. Optionally, it
623supports compression and authenticated encryption. The main goal of Borg is to
624provide an efficient and secure way to backup data. The data deduplication
625technique used makes Borg suitable for daily backups since only changes are
626stored. The authenticated encryption technique makes it suitable for backups
627to not fully trusted targets. Borg is a fork of Attic.")
18533bcf 628 (home-page "https://www.borgbackup.org/")
6fc5c11b 629 (license license:bsd-3)))
b2fe9183
LF
630
631(define-public attic
632 (package
633 (name "attic")
634 (version "0.16")
635 (source (origin
636 (method url-fetch)
99d17446 637 (uri (pypi-uri "Attic" version))
b2fe9183
LF
638 (sha256
639 (base32
640 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
641 (build-system python-build-system)
642 (arguments
1df6d73b
LF
643 `(;; The tests assume they are run as root:
644 ;; https://github.com/jborg/attic/issues/7
645 #:tests? #f
646 #:phases
b2fe9183
LF
647 (modify-phases %standard-phases
648 (add-before
649 'build 'set-openssl-prefix
650 (lambda* (#:key inputs #:allow-other-keys)
651 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
652 #t)))))
653 (inputs
654 `(("acl" ,acl)
655 ("openssl" ,openssl)
656 ("python-msgpack" ,python-msgpack)
657
658 ;; Attic is probably incompatible with llfuse > 0.41.
659 ;; These links are to discussions of llfuse compatibility from
660 ;; the borg project. Borg is a recent fork of attic, and attic
661 ;; has not been updated since the fork, so it's likely that
662 ;; llfuse compatibility requirements are still the same.
663 ;; https://github.com/borgbackup/borg/issues/642
664 ;; https://github.com/borgbackup/borg/issues/643
665 ("python-llfuse" ,python-llfuse-0.41)))
666 (synopsis "Deduplicating backup program")
667 (description "Attic is a deduplicating backup program. The main goal of
668Attic is to provide an efficient and secure way to backup data. The data
669deduplication technique used makes Attic suitable for daily backups since only
670changes are stored.")
671 (home-page "https://attic-backup.org/")
672 (license license:bsd-3)
673 (properties `((superseded . ,borg)))))
3b402139
TGR
674
675(define-public wimlib
676 (package
677 (name "wimlib")
fb6112e9 678 (version "1.13.0")
3b402139
TGR
679 (source (origin
680 (method url-fetch)
681 (uri (string-append "https://wimlib.net/downloads/"
1a05bce2 682 "wimlib-" version ".tar.gz"))
3b402139
TGR
683 (sha256
684 (base32
fb6112e9 685 "02wpsxjlw9vysj6x6q7kmvbcdkpvdzw201mmj5x0q670mapjrnai"))))
3b402139
TGR
686 (build-system gnu-build-system)
687 (native-inputs
688 `(("pkg-config" ,pkg-config)))
689 (inputs
690 `(("fuse" ,fuse)
691 ("libxml2" ,libxml2)
692 ("ntfs-3g" ,ntfs-3g)
693 ("openssl" ,openssl)))
694 (arguments
695 `(#:configure-flags (list "--enable-test-support")))
696 (home-page "https://wimlib.net/")
697 (synopsis "WIM file manipulation library and utilities")
698 (description "wimlib is a C library and set of command-line utilities for
699creating, modifying, extracting, and mounting archives in the Windows Imaging
700Format (@dfn{WIM files}). It can capture and apply WIMs directly from and to
701NTFS volumes using @code{ntfs-3g}, preserving NTFS-specific attributes.")
702 ;; wimlib is dual-licenced under version 3 or later of either the GPL or
703 ;; LGPL, except those files explicitly marked as being released into the
704 ;; public domain (CC0) in their headers.
705 (license (list license:gpl3+
706 license:lgpl3+
707 license:cc0))))
a2fa9c3d
AI
708
709(define-public obnam
710 (package
711 (name "obnam")
712 (version "1.21")
713 (source
714 (origin
715 (method url-fetch)
716 (uri (string-append
717 "http://code.liw.fi/debian/pool/main/o/obnam/obnam_"
718 version ".orig.tar.xz"))
719 (sha256
720 (base32
721 "0qlipsq50hca71zc0dp1mg9zs12qm0sbblw7qfzl0hj6mk2rv1by"))))
722 (build-system python-build-system)
723 (arguments
f75b1400
AI
724 `(#:python ,python-2
725 #:phases
726 (modify-phases %standard-phases
727 (replace 'check
728 (lambda _
729 (substitute* "obnamlib/vfs_local_tests.py"
f32a1803 730 ;; Check for the nobody user instead of root.
f75b1400
AI
731 (("self.fs.get_username\\(0\\), 'root'")
732 "self.fs.get_username(65534), 'nobody'")
f32a1803 733 ;; Disable tests checking for root group.
f75b1400
AI
734 (("self.fs.get_groupname\\(0\\)") "'root'"))
735 (substitute* "obnamlib/vfs_local.py"
f32a1803 736 ;; Don't cover get_groupname function.
f75b1400
AI
737 (("def get_groupname\\(self, gid\\):")
738 "def get_groupname(self, gid): # pragma: no cover"))
f32a1803
TGR
739 ;; Can't run network tests.
740 (invoke "./check" "--unit-tests"))))))
a2fa9c3d
AI
741 (inputs
742 `(("python2-cliapp" ,python2-cliapp)
743 ("python2-larch" ,python2-larch)
744 ("python2-paramiko" ,python2-paramiko)
745 ("python2-pyaml" ,python2-pyaml)
746 ("python2-tracing" ,python2-tracing)
747 ("python2-ttystatus" ,python2-ttystatus)))
f75b1400
AI
748 (native-inputs
749 `(("gnupg" ,gnupg)
750 ("python2-coverage" ,python2-coverage)
751 ("python2-coverage-test-runner" ,python2-coverage-test-runner)
752 ("python2-pep8" ,python2-pep8)
753 ("python2-pylint" ,python2-pylint)))
a2fa9c3d 754 (home-page "https://obnam.org/")
a93de1ae
TGR
755 (synopsis "Retired backup program")
756 (description
757 "Warning: @uref{https://blog.liw.fi/posts/2017/08/13/retiring_obnam/,
758the Obnam project is retired}. You should use another backup solution instead.
759
760Obnam was an easy, secure backup program. Features included snapshot backups,
761data de-duplication and encrypted backups using GnuPG. Backups can be stored on
762local hard disks, or online via the SSH SFTP protocol. The backup server, if
763used, does not require any special software, on top of SSH.")
a2fa9c3d 764 (license license:gpl3+)))
0ff4425c
CAW
765
766(define-public dirvish
767 (package
768 (name "dirvish")
769 (version "1.2.1")
770 (build-system gnu-build-system)
771 (source (origin
772 (method url-fetch)
773 (uri (string-append
774 "http://dirvish.org/dirvish-" version ".tgz"))
775 (sha256
776 (base32
777 "1kbxa1irszp2zw8hd5qzqnrrzb4vxfivs1vn64yxnj0lak1jjzvb"))))
778 (arguments
779 `(#:modules ((ice-9 match) (ice-9 rdelim)
780 ,@%gnu-build-system-modules)
781 #:phases
782 ;; This mostly mirrors the steps taken in the install.sh that ships
783 ;; with dirvish, but simplified because we aren't prompting interactively
784 (modify-phases %standard-phases
785 (delete 'configure)
786 (delete 'build)
787 (delete 'check)
788 (replace 'install
789 (lambda* (#:key inputs outputs #:allow-other-keys)
790 ;; These are mostly the same steps the install.sh that comes with
791 ;; dirvish does
792 (let* (;; Files we'll be copying
793 (executables
794 '("dirvish" "dirvish-runall"
795 "dirvish-expire" "dirvish-locate"))
796 (man-pages
797 '(("dirvish" "8") ("dirvish-runall" "8")
798 ("dirvish-expire" "8") ("dirvish-locate" "8")
799 ("dirvish.conf" "5")))
800
801 (output-dir
802 (assoc-ref outputs "out"))
803
804 ;; Just a default... not so useful on guixsd though
805 ;; You probably want to a service with file(s) to point to.
806 (confdir "/etc/dirvish")
807
808 (perl (string-append (assoc-ref %build-inputs "perl")
809 "/bin/perl"))
810 (loadconfig.pl (call-with-input-file "loadconfig.pl"
811 read-string)))
812
813
814 (define (write-pl filename)
815 (define pl-header
816 (string-append "#!" perl "\n\n"
817 "$CONFDIR = \"" confdir "\";\n\n"))
818 (define input-file-location
819 (string-append filename ".pl"))
820 (define target-file-location
821 (string-append output-dir "/bin/" filename ".pl"))
822 (define text-to-write
823 (string-append pl-header
824 (call-with-input-file input-file-location
825 read-string)
826 "\n" loadconfig.pl))
827 (with-output-to-file target-file-location
828 (lambda ()
829 (display text-to-write)))
830 (chmod target-file-location #o755)
831 (wrap-program target-file-location
832 `("PERL5LIB" ":" prefix
833 ,(map (lambda (l) (string-append (assoc-ref %build-inputs l)
834 "/lib/perl5/site_perl"))
835 '("perl-libtime-period"
836 "perl-libtime-parsedate")))))
837
838 (define write-man
839 (match-lambda
840 ((file-base man-num)
841 (let* ((filename
842 (string-append file-base "." man-num))
843 (output-path
844 (string-append output-dir
845 "/share/man/man" man-num
846 "/" filename)))
847 (copy-file filename output-path)))))
848
849 ;; Make directories
850 (mkdir-p (string-append output-dir "/bin/"))
851 (mkdir-p (string-append output-dir "/share/man/man8/"))
852 (mkdir-p (string-append output-dir "/share/man/man5/"))
853
854 ;; Write out executables
855 (for-each write-pl executables)
856 ;; Write out man pages
857 (for-each write-man man-pages)
858 #t))))))
859 (inputs
860 `(("perl" ,perl)
861 ("rsync" ,rsync)
862 ("perl-libtime-period" ,perl-libtime-period)
863 ("perl-libtime-parsedate" ,perl-libtime-parsedate)))
864 (home-page "http://dirvish.org/")
865 (synopsis "Fast, disk based, rotating network backup system")
866 (description
867 "With dirvish you can maintain a set of complete images of your
162a1374 868file systems with unattended creation and expiration. A dirvish backup vault
0ff4425c
CAW
869is like a time machine for your data. ")
870 (license (license:fsf-free "file://COPYING"
871 "Open Software License 2.0"))))
f77886c1 872
f49d6909 873(define-public restic
f77886c1
OP
874 (package
875 (name "restic")
0e296c06 876 (version "0.9.4")
f49d6909
LF
877 ;; TODO Try packaging the bundled / vendored dependencies in the 'vendor/'
878 ;; directory.
f77886c1
OP
879 (source (origin
880 (method url-fetch)
881 (uri (string-append
882 "https://github.com/restic/restic/releases/download/"
883 "v" version "/restic-" version ".tar.gz"))
884 (file-name (string-append name "-" version ".tar.gz"))
885 (sha256
886 (base32
0e296c06 887 "13ksprq1ia86px8x4lqrmx0l6y9rb1ppg8pnp7lcx0zxnq7skp67"))))
f77886c1
OP
888 (build-system go-build-system)
889 (arguments
890 `(#:import-path "github.com/restic/restic"
891 #:unpack-path "github.com/restic"
892 ;; We don't need to install the source code for end-user applications.
893 #:install-source? #f
894 #:phases
895 (modify-phases %standard-phases
896 (replace 'build
897 (lambda* (#:key inputs #:allow-other-keys)
898 (with-directory-excursion (string-append
899 "src/github.com/restic/restic-"
900 ,version)
9cac043c
TGR
901 ;; Disable 'restic self-update'. It makes little sense in Guix.
902 (substitute* "build.go" (("selfupdate") ""))
15595644 903 (setenv "HOME" (getcwd)) ; for $HOME/.cache/go-build
f77886c1
OP
904 (invoke "go" "run" "build.go"))))
905
4976ebdd
OP
906 (replace 'check
907 (lambda _
908 (with-directory-excursion (string-append
909 "src/github.com/restic/restic-"
910 ,version)
77389911
OP
911 ;; Disable FUSE tests.
912 (setenv "RESTIC_TEST_FUSE" "0")
4976ebdd
OP
913 (invoke "go" "run" "build.go" "--test"))))
914
f77886c1
OP
915 (replace 'install
916 (lambda* (#:key outputs #:allow-other-keys)
917 (let ((out (assoc-ref outputs "out"))
918 (src (string-append "src/github.com/restic/restic-"
919 ,version)))
920 (install-file (string-append src "/restic")
921 (string-append out "/bin"))
922 #t)))
923
924 (add-after 'install 'install-docs
925 (lambda* (#:key outputs #:allow-other-keys)
926 (let* ((out (assoc-ref outputs "out"))
927 (man "/share/man")
928 (man-section (string-append man "/man"))
929 (src (string-append "src/github.com/restic/restic-"
930 ,version "/doc/man/")))
931 ;; Install all the man pages to "out".
932 (for-each
933 (lambda (file)
934 (install-file file
935 (string-append out man-section
936 (string-take-right file 1))))
937 (find-files src "\\.[1-9]"))
938 #t)))
939
940 (add-after 'install-docs 'install-shell-completion
941 (lambda* (#:key outputs #:allow-other-keys)
942 (let* ((out (assoc-ref outputs "out"))
943 (bin (string-append out "/bin"))
944 (etc (string-append out "/etc"))
945 (share (string-append out "/share")))
946 (for-each
947 (lambda (shell)
948 (let* ((shell-name (symbol->string shell))
949 (dir (string-append "etc/completion/" shell-name)))
950 (mkdir-p dir)
951 (invoke (string-append bin "/restic") "generate"
952 (string-append "--" shell-name "-completion")
953 (string-append dir "/"
954 (case shell
955 ((bash) "restic")
956 ((zsh) "_restic"))))))
957 '(bash zsh))
958 (with-directory-excursion "etc/completion"
959 (install-file "bash/restic"
960 (string-append etc "/bash_completion.d"))
961 (install-file "zsh/_restic"
962 (string-append share "/zsh/site-functions")))
963 #t))))))
964 (home-page "https://restic.net/")
965 (synopsis "Backup program with multiple revisions, encryption and more")
966 (description "Restic is a program that does backups right and was designed
967with the following principles in mind:
968
969@itemize
970@item Easy: Doing backups should be a frictionless process, otherwise you
971might be tempted to skip it. Restic should be easy to configure and use, so
972that, in the event of a data loss, you can just restore it. Likewise,
973restoring data should not be complicated.
974
975@item Fast: Backing up your data with restic should only be limited by your
976network or hard disk bandwidth so that you can backup your files every day.
977Nobody does backups if it takes too much time. Restoring backups should only
978transfer data that is needed for the files that are to be restored, so that
979this process is also fast.
980
981@item Verifiable: Much more important than backup is restore, so restic
982enables you to easily verify that all data can be restored. @item Secure:
983Restic uses cryptography to guarantee confidentiality and integrity of your
984data. The location the backup data is stored is assumed not to be a trusted
985environment (e.g. a shared space where others like system administrators are
986able to access your backups). Restic is built to secure your data against
987such attackers.
988
989@item Efficient: With the growth of data, additional snapshots should only
990take the storage of the actual increment. Even more, duplicate data should be
991de-duplicated before it is actually written to the storage back end to save
992precious backup space.
993@end itemize")
994 (license license:bsd-2)))
7b9b203a
RW
995
996(define-public burp
997 (package
998 (name "burp")
999 (version "2.3.0")
1000 (source (origin
1001 (method url-fetch)
1002 (uri (string-append "mirror://sourceforge/burp/burp-" version
1003 "/burp-" version ".tar.bz2"))
1004 (sha256
1005 (base32
1006 "0in49c0ir7lb7jli0fcphdq1nh5rclhans4ngm7z7hzyxa4jrgri"))))
1007 (build-system gnu-build-system)
1008 (inputs
1009 `(("librsync" ,librsync)
1010 ("openssl" ,openssl)
1011 ("uthash" ,uthash)
1012 ("zlib" ,zlib)))
1013 (native-inputs
1014 `(("check" ,check)
1015 ("pkg-config" ,pkg-config)))
1016 (home-page "https://burp.grke.org")
1017 (synopsis "Differential backup and restore")
1018 (description "Burp is a network backup and restore program. It attempts
1019to reduce network traffic and the amount of space that is used by each
1020backup.")
1021 (license license:agpl3)))