Subject: [bug#76324] [PATCH 2/6] gnu: sync: add seafile

From: flypaper <[email-masked]>
Date: Sun, 16 Feb 2025 11:38:45 +0200

* gnu/packages/sync.scm (seafile): New package.

Change-Id: Ieefb70e70a5e13c574513f2cf36d16475e693c48
---
 gnu/packages/sync.scm | 64 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/sync.scm b/gnu/packages/sync.scm
index 854cc075ea..d65f1db018 100644
--- a/gnu/packages/sync.scm
+++ b/gnu/packages/sync.scm
@@ -31,6 +31,7 @@ (define-module (gnu packages sync)
   #:use-module (guix build-system go)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system qt)
+  #:use-module (guix build-system python)
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix download)
@@ -70,7 +71,10 @@ (define-module (gnu packages sync)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls)
-  #:use-module (gnu packages web))
+  #:use-module (gnu packages web)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages password-utils)
+  #:use-module (gnu packages cmake))
 
 (define-public nextcloud-client
   (package
@@ -630,3 +634,61 @@ (define-public libsearpc
         #:configure-flags '(list "--disable-compile-demo")))
       (inputs (list glib jansson python))
       (native-inputs (list autoconf automake libtool pkg-config)))))
+
+(define-public seafile
+  (package
+    (name "seafile")
+    (version "9.0.9")
+    (home-page "https://github.com/haiwen/seafile")
+    (source
+     (origin
+       (method git-fetch)
+       (file-name (git-file-name name version))
+       (uri (git-reference
+             (url home-page)
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "0c5j1xwx6pailx7x8xkrhrkmcn87aff3hvq4af5nzrqbpyiin5xb"))))
+    (arguments
+     (list
+      #:imported-modules `(,@%python-build-system-modules)
+      #:modules '((guix build gnu-build-system)
+                  ((guix build python-build-system)
+                   #:prefix python:)
+                  (guix build utils))
+      #:phases #~(modify-phases %standard-phases
+                   ;; seaf-cli requires libsearpc and itself on its PYTHONPATH
+                   ;; so we wrap it so that we dont need to use propagated modules
+                   (add-after 'install 'wrap
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (wrap-program (string-append #$output "/bin/seaf-cli")
+                         `("GUIX_PYTHONPATH" =
+                           (,(getenv "GUIX_PYTHONPATH") ,(python:site-packages
+                                                          inputs outputs)))))))))
+
+    (build-system gnu-build-system)
+    (inputs (list libsearpc
+                  libevent
+                  libwebsockets
+                  curl
+                  gtk
+                  util-linux ;known in debian as uuid-dev
+                  sqlite
+                  jansson
+                  openssl ;debian libssl-dev
+                  glib
+                  argon2
+                  python
+                  bash-minimal))
+    (synopsis
+     "Command-line client and daemon for syncing with Seafile servers")
+    (description "This package provides @code{seaf-cli} and @{seaf-daemon}.")
+    (license license:gpl3+)
+    (native-inputs (list vala
+                         intltool
+                         cmake-minimal
+                         autoconf
+                         automake
+                         libtool
+                         pkg-config))))
+
-- 
2.46.0