summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYarl Baudig <yarl-baudig@mailoo.org>2026-03-14 13:22:58 +0100
committerIan Eure <ian@retrospec.tv>2026-03-21 19:01:26 -0700
commite931cab87fef3159511a6f425e5cddbeb8b06c96 (patch)
treeaa60487c2bc75e94b5baa874f8efb1ccc8b349e2
parent61849b667726dd30d623b517380f5b12655b115a (diff)
gnu: home: services: Add home-git-annex-assistant-service-type
* gnu/home/services/git-annex-assistant.scm: New file. * gnu/local/mk (GNU_SYSTEM_MODULES): Register it. * doc/guix.texi (Miscellaneous Services): Document it. Change-Id: I9ca75210dfe7f6d2d81b9eb8919d6eb34c7bb002 Signed-off-by: Ian Eure <ian@retrospec.tv>
-rw-r--r--doc/guix.texi40
-rw-r--r--gnu/home/services/git-annex-assistant.scm83
-rw-r--r--gnu/local.mk1
3 files changed, 124 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index d5f782f35c4..f4279bfb794 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -150,6 +150,7 @@ Copyright @copyright{} 2025 dan@*
150Copyright @copyright{} 2025 Noé Lopez@* 150Copyright @copyright{} 2025 Noé Lopez@*
151Copyright @copyright{} 2026 David Elsing@* 151Copyright @copyright{} 2026 David Elsing@*
152Copyright @copyright{} 2026 Nguyễn Gia Phong@* 152Copyright @copyright{} 2026 Nguyễn Gia Phong@*
153Copyright @copyright{} 2026 Yarl Baudig@*
153 154
154Permission is granted to copy, distribute and/or modify this document 155Permission is granted to copy, distribute and/or modify this document
155under the terms of the GNU Free Documentation License, Version 1.3 or 156under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -55053,6 +55054,45 @@ You may specify a custom configuration by providing a
55053 '(("grafana:/var/lib/grafana")))))))) 55054 '(("grafana:/var/lib/grafana"))))))))
55054@end lisp 55055@end lisp
55055 55056
55057@subsubheading git-annex assistant Service
55058
55059@cindex git-annex assistant service
55060The @code{(gnu home services git-annex-assistant)} module provides a
55061service to run the @uref{https://git-annex.branchable.com/assistant/,
55062git-annex assistant}.
55063
55064@defvar home-git-annex-assistant-service-type
55065This is the type of the service that runs the assistant. You must
55066supply a @code{<home-git-annex-assistant-configuration>}.
55067
55068The service runs one assistant for each directory provided. For
55069example:
55070
55071@lisp
55072(service home-git-annex-assistant-service-type
55073 (home-git-annex-assistant-configuration
55074 (directories '("/path/to/foo" "/path/to/bar"))))
55075@end lisp
55076@end defvar
55077
55078@c %start of fragment
55079
55080@deftp {Data Type} home-git-annex-assistant-configuration
55081Available @code{home-git-annex-assistant-configuration} fields are:
55082
55083@table @asis
55084@item @code{package} (default: @code{git-annex}) (type: package)
55085Package that provides @code{git-annex}.
55086
55087@item @code{directories} (default: @code{()}) (type: list-of-strings)
55088List of directories.
55089
55090@end table
55091
55092@end deftp
55093
55094@c %end of fragment
55095
55056@node Invoking guix home 55096@node Invoking guix home
55057@section Invoking @command{guix home} 55097@section Invoking @command{guix home}
55058 55098
diff --git a/gnu/home/services/git-annex-assistant.scm b/gnu/home/services/git-annex-assistant.scm
new file mode 100644
index 00000000000..e8885b8cda7
--- /dev/null
+++ b/gnu/home/services/git-annex-assistant.scm
@@ -0,0 +1,83 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2026 Yarl Baudig <yarl-baudig@mailoo.org>
3
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu home services git-annex-assistant)
21 #:use-module (guix gexp)
22 #:use-module ((guix packages) #:select (package?))
23 #:use-module (guix records)
24 #:use-module (gnu services configuration)
25 #:use-module (gnu home services)
26 #:use-module (gnu home services shepherd)
27 #:use-module (gnu packages haskell-apps)
28 #:use-module (srfi srfi-1)
29 #:export (home-git-annex-assistant-configuration
30 home-git-annex-assistant-service-type))
31
32(define-configuration/no-serialization home-git-annex-assistant-configuration
33 (package
34 (package git-annex)
35 "Package that provides @code{git-annex}.")
36 (directories
37 (list-of-strings '())
38 "List of directories."))
39
40(define (home-git-annex-assistant-shepherd-services config)
41 (match-record config
42 <home-git-annex-assistant-configuration> (package directories)
43 (let ((gaa-command
44 #~(list (string-append #$package "/bin/git-annex") "assistant")))
45 (map
46 (lambda (dir)
47 (let ((pid-file (in-vicinity dir ".git/annex/daemon.pid")))
48 (shepherd-service
49 (documentation
50 (string-append "Run git-annex assistant against " dir "."))
51 (provision
52 (list
53 (symbol-append 'home-git-annex-assistant-
54 (string->symbol dir))))
55 (start #~(lambda _
56 (and (zero? (spawn-command #$gaa-command
57 #:directory #$dir))
58 (read-pid-file #$pid-file))))
59 (stop #~(lambda _
60 (unless (zero? (spawn-command
61 (append #$gaa-command '("--stop"))
62 #:directory #$dir))
63 (error "failed to stop git-annex assistant"))
64 #f)))))
65 directories))))
66
67(define home-git-annex-assistant-service-type
68 (service-type
69 (name 'git-annex-assistant)
70 (extensions
71 (list (service-extension home-shepherd-service-type
72 home-git-annex-assistant-shepherd-services)))
73 (compose concatenate)
74 (extend (lambda (config directories)
75 (home-git-annex-assistant-configuration
76 (inherit config)
77 (directories
78 (append
79 (home-git-annex-assistant-configuration-directories config)
80 directories)))))
81 (description
82 "Run the git-annex assistant daemon on a list of directories.")))
83
diff --git a/gnu/local.mk b/gnu/local.mk
index 25ac77b706b..6455e9feb3d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -113,6 +113,7 @@ GNU_SYSTEM_MODULES = \
113 %D%/home/services/dotfiles.scm \ 113 %D%/home/services/dotfiles.scm \
114 %D%/home/services/symlink-manager.scm \ 114 %D%/home/services/symlink-manager.scm \
115 %D%/home/services/fontutils.scm \ 115 %D%/home/services/fontutils.scm \
116 %D%/home/services/git-annex-assistant.scm \
116 %D%/home/services/gnome.scm \ 117 %D%/home/services/gnome.scm \
117 %D%/home/services/gnupg.scm \ 118 %D%/home/services/gnupg.scm \
118 %D%/home/services/guix.scm \ 119 %D%/home/services/guix.scm \