;;; GNU Guix --- Functional package management for GNU (define-module (restic) #:use-module (guix gexp) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system go) #:use-module (gnu packages) #:use-module (gnu packages acl) #:use-module (gnu packages autotools) #:use-module (gnu packages bash) #:use-module (gnu packages base) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages databases) #:use-module (gnu packages datastructures) #:use-module (gnu packages digest) #:use-module (gnu packages dbm) #:use-module (gnu packages dejagnu) #:use-module (gnu packages ftp) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) #:use-module (gnu packages gnupg) #:use-module (gnu packages golang) #:use-module (gnu packages gperf) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages guile-xyz) #:use-module (gnu packages linux) #:use-module (gnu packages mcrypt) #:use-module (gnu packages ncurses) #:use-module (gnu packages nettle) #:use-module (gnu packages networking) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages serialization) #:use-module (gnu packages ssh) #:use-module (gnu packages time) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) #:use-module (gnu packages xml)) (define-public restic-new (package (name "restic-new") (version "0.15.1") ;; TODO Try packaging the bundled / vendored dependencies in the 'vendor/' ;; directory. (source (origin (method url-fetch) (uri (string-append "https://github.com/restic/restic/releases/download/" "v" version "/restic-" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0lhck49zzkdaya20naxf8aryg9p8smk0fr5abnimh0dcrpyq5qzw")) ;(patches ;(search-patches "restic-0.9.6-fix-tests-for-go1.15.patch")) )) (build-system go-build-system) (arguments `(#:import-path "github.com/restic/restic" #:go ,go-1.20 ;; We don't need to install the source code for end-user applications. #:install-source? #f #:phases (modify-phases %standard-phases (replace 'build (lambda* (#:key inputs #:allow-other-keys) (with-directory-excursion "src/github.com/restic/restic" ;; Disable 'restic self-update'. It makes little sense in Guix. (substitute* "build.go" (("selfupdate") "")) (setenv "HOME" (getcwd)) ; for $HOME/.cache/go-build (invoke "go" "run" "build.go")))) (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? (with-directory-excursion "src/github.com/restic/restic" ;; Disable FUSE tests. (setenv "RESTIC_TEST_FUSE" "0") (invoke "go" "run" "build.go" "--test"))))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (src "src/github.com/restic/restic")) (install-file (string-append src "/restic") (string-append out "/bin")) #t))) (add-after 'install 'install-docs (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (man "/share/man") (man-section (string-append man "/man")) (src "src/github.com/restic/restic/doc/man/")) ;; Install all the man pages to "out". (for-each (lambda (file) (install-file file (string-append out man-section (string-take-right file 1)))) (find-files src "\\.[1-9]")) #t))) (add-after 'install-docs 'install-shell-completion (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (etc (string-append out "/etc")) (share (string-append out "/share"))) (for-each (lambda (shell) (let* ((shell-name (symbol->string shell)) (dir (string-append "etc/completion/" shell-name))) (mkdir-p dir) (invoke (string-append bin "/restic") "generate" (string-append "--" shell-name "-completion") (string-append dir "/" (case shell ((bash) "restic") ((zsh) "_restic")))))) '(bash zsh)) (with-directory-excursion "etc/completion" (install-file "bash/restic" (string-append etc "/bash_completion.d")) (install-file "zsh/_restic" (string-append share "/zsh/site-functions"))) #t)))))) (home-page "https://restic.net/") (synopsis "Backup program with multiple revisions, encryption and more") (description "Restic is a program that does backups right and was designed with the following principles in mind: @itemize @item Easy: Doing backups should be a frictionless process, otherwise you might be tempted to skip it. Restic should be easy to configure and use, so that, in the event of a data loss, you can just restore it. Likewise, restoring data should not be complicated. @item Fast: Backing up your data with restic should only be limited by your network or hard disk bandwidth so that you can backup your files every day. Nobody does backups if it takes too much time. Restoring backups should only transfer data that is needed for the files that are to be restored, so that this process is also fast. @item Verifiable: Much more important than backup is restore, so restic enables you to easily verify that all data can be restored. @item Secure: Restic uses cryptography to guarantee confidentiality and integrity of your data. The location the backup data is stored is assumed not to be a trusted environment (e.g. a shared space where others like system administrators are able to access your backups). Restic is built to secure your data against such attackers. @item Efficient: With the growth of data, additional snapshots should only take the storage of the actual increment. Even more, duplicate data should be de-duplicated before it is actually written to the storage back end to save precious backup space. @end itemize") (license license:bsd-2)))