From 59bb53823e6babb2d50e246d312879980c7988c9 Mon Sep 17 00:00:00 2001
From: Richard Sent <richard@freakingpenguin.com>
Date: Thu, 21 Mar 2024 14:36:43 -0400
Subject: services: Add the Guix Home service.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch adds a Guix Home service, which allows for configuring/deploying an
operating-system declaration with an associated home-environment.

* gnu/services/guix.scm: Add guix-home-service and guix-home-shepherd-service
* gnu/home/services/shepherd.scm: Don't attempt to launch user shepherd when
the system shepherd runs guix-home-<user>
* doc/guix.texi: Add documentation for guix-home-service
* gnu/tests/guix.scm: Add a test to verify guix-home-service-type is able to
activate a home environment

Change-Id: Ifbcc0878d934aa4abe34bb2123b5081fb432aa8e
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/home/services/shepherd.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'gnu/home')

diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm
index 962e633618..a3ca21b319 100644
--- a/gnu/home/services/shepherd.scm
+++ b/gnu/home/services/shepherd.scm
@@ -144,7 +144,12 @@ as shepherd package."
               (format #f "/run/user/~a" (getuid)))
           "/shepherd/socket"))
         #$(reload-configuration-gexp config)
-        #$(launch-shepherd-gexp config)))
+        ;; Don't attempt to start user shepherd if the system is running the
+        ;; activation script. /run/user/<uid> may not have been created
+        ;; yet. But do otherwise so if the runtime dir does not exist an error
+        ;; is logged.
+        (unless (getenv "GUIX_SYSTEM_IS_RUNNING_HOME_ACTIVATE")
+          #$(launch-shepherd-gexp config))))
 
 (define (shepherd-xdg-configuration-files config)
   `(("shepherd/init.scm" ,(home-shepherd-configuration-file config))))
-- 
cgit v1.2.3