summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi44
-rw-r--r--gnu/home/services/gnome.scm104
-rw-r--r--gnu/local.mk1
3 files changed, 149 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 67156cbfa4f..a83219a9fd0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -51897,6 +51897,50 @@ API.
51897@end table 51897@end table
51898@end deftp 51898@end deftp
51899 51899
51900@defvar home-gcr-ssh-agent-service-type
51901
51902GNOME Keyring used to be able to act as a wrapper over
51903@command{ssh-agent}. It would display a graphical password entry
51904dialog, including a checkbox to remember the password, which, if
51905selected, would allow fully passwordless use of that key.
51906
51907The SSH functionality is disabled by default in
51908@command{gnome-keyring-daemon} builds since version
51909@uref{https://gitlab.gnome.org/GNOME/gnome-keyring/-/commit25c5a1982467802fa12c6852b03c57924553ba73,
519101.46}. It has been
51911@uref{https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/67, moved}
51912into @command{gcr-ssh-agent}, which is part of the @code{gcr} package.
51913
51914To enable the SSH agent functionality it is sufficient to add the
51915following to your Home configuration.
51916
51917@lisp
51918(use-modules (gnu home services gnome) ;for 'home-gcr-ssh-agent-service-type'
51919 @dots{})
51920
51921(home-environment
51922 (services
51923 (list
51924 @dots{}
51925 (service home-gcr-ssh-agent-service-type))))
51926@end lisp
51927@end defvar
51928
51929@deftp {Data Type} gcr-ssh-agent-configuration
51930The configuration record for @code{home-gcr-ssh-agent-service-type}. Its
51931available fields are:
51932
51933@table @asis
51934@item @code{package} (default: @code{gcr}) (type: package)
51935The @code{gcr} package to use.
51936
51937@item @code{log-file} (type: maybe-string)
51938Where the service will write its logs. If unset, it defaults to
51939@file{$HOME/.local/state/shepherd/gcr-ssh-agent.log}.
51940
51941@end table
51942@end deftp
51943
51900@node Guix Home Services 51944@node Guix Home Services
51901@subsection Guix Home Services 51945@subsection Guix Home Services
51902 51946
diff --git a/gnu/home/services/gnome.scm b/gnu/home/services/gnome.scm
new file mode 100644
index 00000000000..a6c75ab3e2d
--- /dev/null
+++ b/gnu/home/services/gnome.scm
@@ -0,0 +1,104 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2025 Giacomo Leidi <goodoldpaul@autistici.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify
7;;; it under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation, either version 3 of the License, or
9;;; (at your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19
20(define-module (gnu home services gnome)
21 #:use-module (guix gexp)
22 #:use-module (guix packages)
23 #:use-module (gnu packages admin)
24 #:use-module (gnu packages gnome)
25 #:use-module (gnu system accounts)
26 #:use-module (gnu services configuration)
27 #:use-module (gnu home services)
28 #:use-module (gnu home services shepherd)
29 #:export (gcr-ssh-agent-configuration
30 gcr-ssh-agent-configuration?
31 gcr-ssh-agent-configuration-fields
32 gcr-ssh-agent-configuration-package
33 gcr-ssh-agent-configuration-log-file
34
35 home-gcr-ssh-agent-log-file
36 home-gcr-ssh-agent-shepherd-service
37
38 home-gcr-ssh-agent-service-type))
39
40(define-maybe/no-serialization string)
41
42(define-configuration/no-serialization gcr-ssh-agent-configuration
43 (package
44 (package gcr)
45 "The @code{gcr} package to use.")
46 (log-file
47 (maybe-string)
48 "Where the service will write its logs. If unset, it defaults to
49@file{$HOME/.local/state/shepherd/gcr-ssh-agent.log}."))
50
51(define (home-gcr-ssh-agent-log-file config)
52 (define maybe-log-file (gcr-ssh-agent-configuration-log-file config))
53 (if (maybe-value-set? maybe-log-file)
54 maybe-log-file
55 #~(string-append %user-log-dir "/gcr-ssh-agent.log")))
56
57(define (home-gcr-ssh-agent-shepherd-service config)
58 (let ((package
59 (gcr-ssh-agent-configuration-package config))
60 (log-file (home-gcr-ssh-agent-log-file config)))
61 (list
62 (shepherd-service
63 (provision '(gcr-ssh-agent ssh-agent))
64 (modules
65 ;;for '%user-log-dir' and '%user-runtime-dir'
66 '((shepherd support)))
67 (start
68 #~(let* ((socket-directory
69 (string-append %user-runtime-dir
70 "/gcr"))
71 (socket-endpoint
72 (endpoint
73 (make-socket-address
74 AF_UNIX
75 (string-append socket-directory "/ssh"))
76 #:name "ssh"
77 #:socket-directory-permissions #o700)))
78 (make-systemd-constructor
79 (list #$(file-append package
80 "/libexec/gcr-ssh-agent")
81 "-d" socket-directory)
82 (list socket-endpoint)
83 ;; With #:lazy-start #t the first ssh connection
84 ;; hangs indefinitely.
85 #:lazy-start? #f
86 #:log-file #$log-file)))
87 (stop #~(make-systemd-destructor))))))
88
89(define (home-gcr-ssh-agent-environment-variables config)
90 `(("SSH_AUTH_SOCK" . "${XDG_RUNTIME_DIR}/gcr/ssh")))
91
92(define home-gcr-ssh-agent-service-type
93 (service-type
94 (name 'home-gcr-ssh-agent)
95 (extensions
96 (list (service-extension
97 home-shepherd-service-type
98 home-gcr-ssh-agent-shepherd-service)
99 (service-extension home-environment-variables-service-type
100 home-gcr-ssh-agent-environment-variables)))
101 (default-value (gcr-ssh-agent-configuration))
102 (description
103 "Provides @code{gcr-ssh-agent} Shepherd service and installs
104@code{gcr} in the system profile.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index 4c26080e2d3..1d7d06c6442 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -112,6 +112,7 @@ GNU_SYSTEM_MODULES = \
112 %D%/home/services/dotfiles.scm \ 112 %D%/home/services/dotfiles.scm \
113 %D%/home/services/symlink-manager.scm \ 113 %D%/home/services/symlink-manager.scm \
114 %D%/home/services/fontutils.scm \ 114 %D%/home/services/fontutils.scm \
115 %D%/home/services/gnome.scm \
115 %D%/home/services/gnupg.scm \ 116 %D%/home/services/gnupg.scm \
116 %D%/home/services/guix.scm \ 117 %D%/home/services/guix.scm \
117 %D%/home/services/mail.scm \ 118 %D%/home/services/mail.scm \