summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorSergio Pastor Pérez <sergio.pastorperez@outlook.es>2024-07-28 19:09:41 +0200
committerLudovic Courtès <ludo@gnu.org>2024-08-21 19:04:25 +0200
commita1d367d6ee8c1783ef94cebbc5f2ae3b7a08078d (patch)
tree743f68fbc86deded42e27f23790238bf524f6db7 /gnu/services
parent0b65a43cf8d0c190113461315ac62c1b1c367535 (diff)
downloadguix-a1d367d6ee8c1783ef94cebbc5f2ae3b7a08078d.tar.gz
services: syncthing: incorrect guessing of HOME variable
Fixed the issue described here:
https://lists.gnu.org/archive/html/help-guix/2024-01/msg00034.html

Fix `syncthing-shepherd-service` failing to guess the correct `HOME`
environment variable when it's `<syncthing-configuration>` does not have a
value for the `home` or `user` fields.

* gnu/services/syncthing.scm (syncthing-shepherd-service): Change ‘HOME’
value in #:environment-variables argument.

Change-Id: I102bfe5feba1ebb349a0cde1c987c0c10ebbab7a
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/syncthing.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm
index 9bb623186b..a7a9c6aadd 100644
--- a/gnu/services/syncthing.scm
+++ b/gnu/services/syncthing.scm
@@ -73,7 +73,15 @@
                 #:user #$(and (not home-service?) user)
                 #:group #$(and (not home-service?) group)
                 #:environment-variables
-                (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user))))
+                (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)