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