summaryrefslogtreecommitdiff
path: root/gnu/home/services
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2025-06-01 12:34:24 +0200
committerMaxim Cournoyer <maxim@guixotic.coop>2025-12-01 17:20:55 +0900
commit17fdce75eceda5e16074ea56e1bdfd5535e90d4d (patch)
tree01e2b15f03793c40b21410e41f5d4bca501556c9 /gnu/home/services
parent285229d06ad81c17f674ea6d89a4f2dc4d626627 (diff)
gnu: Add home-gcr-ssh-agent-service-type.
GNOME Keyring used to be able to act as a wrapper over ssh-agent. It would display a GUI password entry dialog, including a checkbox to remember the password, which, if selected, would allow fully passwordless use of that key. The SSH functionality is disabled by default in gnome-keyring-daemon builds since version 1.46 (commit 25c5a1982467802fa12c6852b03c57924553ba73). It has been moved (https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/67) into gcr-ssh-agent, which is part of the gcr package. * gnu/home/services/gnome.scm: New file. (gcr-ssh-agent-log-file,gcr-ssh-agent-shepherd-services): New public procedures. (gcr-ssh-agent-configuration): New configuration record. (home-gcr-ssh-agent-service-type): New service type. * gnu/local.mk: Add it. * doc/guix.texi: Document it. Change-Id: Idd3e40f544d40bb4c6682255f877cb79f0c70850 Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop> Reviewed-by: Dariqq <dariqq@posteo.net> Reviewed-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Modified-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'gnu/home/services')
-rw-r--r--gnu/home/services/gnome.scm104
1 files changed, 104 insertions, 0 deletions
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.")))