aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2023 Justin Veilleux <terramorpha@cock.li>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu services syncthing)
  #:use-module (gnu packages syncthing)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:export (syncthing-configuration
            syncthing-configuration?
            syncthing-service-type))

;;; Commentary:
;;;
;;; This module provides a service definition for the syncthing service.
;;;
;;; Code:

(define-record-type* <syncthing-configuration>
  syncthing-configuration make-syncthing-configuration
  syncthing-configuration?
  (syncthing syncthing-configuration-syncthing ;file-like
             (default syncthing))
  (arguments syncthing-configuration-arguments ;list of strings
             (default '()))
  (logflags  syncthing-configuration-logflags  ;number
             (default 0))
  (user      syncthing-configuration-user      ;string
             (default #f))
  (group     syncthing-configuration-group     ;string
             (default "users"))
  (home      syncthing-configuration-home      ;string
             (default #f))
  (home-service? syncthing-configuration-home-service?
                 (default for-home?) (innate)))

(define syncthing-shepherd-service
  (match-record-lambda <syncthing-configuration>
      (syncthing arguments logflags user group home home-service?)
    (list
     (shepherd-service
      (provision (if home-service?
                     '(syncthing)
                     (list (string->symbol
                            (string-append "syncthing-" user)))))
      (documentation "Run syncthing.")
      (requirement (if home-service? '() '(loopback user-processes)))
      (start #~(make-forkexec-constructor
                (append (list (string-append #$syncthing "/bin/syncthing")
                              "--no-browser"
                              "--no-restart"
                              (string-append "--logflags=" (number->string #$logflags)))
                        '#$arguments)
                #:user #$(and (not home-service?) user)
                #:group #$(and (not home-service?) group)
                #:environment-variables
                (append
                 (list
                  (string-append "HOME="
                                 (or #$home
                                     (passwd:dir
                                      (getpw (if (and #$home-service?
                                                      (not #$user))
                                                 (getuid)
                                                 #$user)))))
                              "SSL_CERT_DIR=/etc/ssl/certs"
                              "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt")
                        (filter (negate       ;XXX: 'remove' is not in (guile)
                                 (lambda (str)
                                   (or (string-prefix? "HOME=" str)
                                       (string-prefix? "SSL_CERT_DIR=" str)
                                       (string-prefix? "SSL_CERT_FILE=" str))))
                                (environ)))))
      (respawn? #f)
      (stop #~(make-kill-destructor))))))

(define syncthing-service-type
  (service-type (name 'syncthing)
                (extensions (list (service-extension shepherd-root-service-type
                                                     syncthing-shepherd-service)))
                (description
                 "Run @uref{https://github.com/syncthing/syncthing, Syncthing}
decentralized continuous file system synchronization.")))

;;; syncthing.scm ends here
7:17 +0100'>2023-09-27gnu: gajim: Update to 1.7.3....* gnu/packages/messaging.scm (gajim): Update to 1.7.3. [arguments]: Switch to "python -m build". To use pyproject-build-system, support for backend-path is needed. Add metadata build and install phase. Switch to "python -m unittest" as test method, following upstream recommendation. Generate gdk-pixbuf cache and include result in wrapper. Allows Gajim to run in pure environments. [native-search-paths]: Update. Signed-off-by: Christopher Baines <mail@cbaines.net> Parnikkapore 2023-09-27gnu: python-nbxmpp: Update to 4.2.2....Gajim will not build at this commit. * gnu/packages/messaging.scm (python-nbxmpp): Update to 4.2.2. [arguments]: Specify "python -m unittest" as test method. Signed-off-by: Christopher Baines <mail@cbaines.net> Parnikkapore 2023-09-05gnu: kaidan: Update to 0.9.0....* gnu/packages/messaging.scm (kaidan): Update to 0.9.0. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> 宋文武 2023-09-05gnu: kaidan: Add missing input....Fixes <https://issues.guix.gnu.org/65684>. * gnu/packages/messaging.scm (kaidan)[inputs]: Add sonnet. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> 宋文武 2023-08-29gnu: profanity: Update to 0.14.0....* gnu/packagex/messaging.scm (profanity): Update to 0.14.0. Signed-off-by: Christopher Baines <mail@cbaines.net> Jack Hill 2023-08-29gnu: dino: Update to 0.4.3....* gnu/packages/messaging.scm (dino): Update to 0.4.3. Signed-off-by: Christopher Baines <mail@cbaines.net> Jack Hill 2023-08-15gnu: dino: Build with librsvg-for-system....* gnu/packages/messaging.scm (dino)[inputs]: Replace librsvg with librsvg-for-system. Efraim Flashner 2023-07-30gnu: libstrophe: Update to 0.12.3....* gnu/packages/messaging.scm (libstrophe): Update to 0.12.3. [arguments]: Don't explicitly return #t from phases. Tobias Geerinckx-Rice 2023-07-10gnu: chatty: Add missing input....* gnu/packages/messaging.scm (chatty)[native-inputs]: Add itstool. Efraim Flashner 2023-06-18gnu: poezio: Add missing input....* gnu/packages/messaging.scm (poezio)[inputs]: Add python-typing-extensions. Efraim Flashner 2023-06-03gnu: python-zulip: Fix test failure....* gnu/packages/messaging.scm (python-zulip): Fix test failure. Signed-off-by: Christopher Baines <mail@cbaines.net> gemmaro 2023-05-24gnu: prosody: Update to 0.12.3....* gnu/packages/messaging.scm (prosody): Update to 0.12.3. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> André Batista 2023-05-19gnu: packages: Fix weechat-wee-slack build....* gnu/packages/messaging.scm (weechat-wee-slack)[inputs]: Add python-mock test dependency. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Lilah Tascheter 2023-05-19gnu: gajim: Add missing input....Fixes <https://issues.guix.gnu.org/issue/62956>. * gnu/packages/messaging.scm (gajim)[inputs]: Add python-idna. Lars-Dominik Braun