Subject: [bug#66892] [PATCH] gnu: Add duply.

From: Jonathan Pieper <[email-masked]>
Date: Tue, 9 Apr 2024 20:43:30 +0200

Change-Id: I0da1ebc0571c34d3d049eb5736393abead9e08b3
---
 gnu/packages/backup.scm | 50 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 699f4cbc8f..e6fcc48f20 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2022 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2022 Feng Shu <[email-masked]>
 ;;; Copyright © 2023 Timo Wilken <[email-masked]>
+;;; Copyright © 2023, 2024 Jonathan Pieper <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,6 +44,7 @@
 (define-module (gnu packages backup)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python)
@@ -194,6 +196,54 @@ (define-public duplicity
 spying and/or modification by the server.")
     (license license:gpl2+)))
 
+(define-public duply
+  (package
+    (name "duply")
+    (version "2.5.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/ftplicity/duply%20%28simple%20duplicity%29/"
+             (version-major+minor version) ".x/duply_"
+             (version-major+minor+point version) ".tgz"))
+       (sha256
+        (base32 "0iyyx60nyxq0z6hvl4szxx64wg548fi3n3s5vrac0ai128pclpxk"))))
+    (build-system copy-build-system)
+    (inputs (list bash-minimal)) ; to run the wrapped program
+    (propagated-inputs (list duplicity python))
+    (arguments
+     (list
+      #:install-plan #~'(("duply" "bin/duply")
+                         ("gpl-2.0.txt" #$(string-append "share/doc/" name "-"
+                                                         version "/LICENSE.txt"))
+                         ("CHANGELOG.txt" #$(string-append "share/doc/" name "-"
+                                                           version "/CHANGELOG.txt")))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'install 'wrap-executable
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (let ((out (assoc-ref outputs "out"))
+                             (python (string-append (assoc-ref inputs "python")
+                                                    "/bin/python3")))
+                         (wrap-program (string-append out "/bin/duply")
+                           `("DUPL_PYTHON_BIN" =
+                             (,python)))))))))
+    (home-page "https://duply.net/Duply_(simple_duplicity)")
+    (synopsis "Wrapper for automated duplicity backup configuration")
+    (description
+     "duply simplifies running duplicity with cron or on command line by:
+
+- keeping recurring settings in profiles per backup job
+
+- automated import/export of keys between profile and keyring
+
+- enabling batch operations eg. backup_verify_purge
+
+- executing pre/post scripts
+
+- precondition checking for flawless duplicity operation")
+    (license license:gpl2)))
+
 (define-public par2cmdline
   (package
     (name "par2cmdline")

base-commit: 9a1abc1352b772e7062a170083344f4803280979
-- 
2.41.0