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