aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorRichard Sent <richard@freakingpenguin.com>2024-03-21 14:36:43 -0400
committerLudovic Courtès <ludo@gnu.org>2024-04-17 12:13:03 +0200
commit59bb53823e6babb2d50e246d312879980c7988c9 (patch)
treee20d682176458fdc8514185da5cd1dc84b5bfd33 /gnu/tests
parent9f8e92cc7d8cbcb2709dda5f3f0287215441d939 (diff)
downloadguix-59bb53823e6babb2d50e246d312879980c7988c9.tar
guix-59bb53823e6babb2d50e246d312879980c7988c9.tar.gz
services: Add the Guix Home service.
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>
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/guix.scm73
1 files changed, 73 insertions, 0 deletions
diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm
index 240ded4825..12ad1bf255 100644
--- a/gnu/tests/guix.scm
+++ b/gnu/tests/guix.scm
@@ -17,6 +17,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu tests guix)
+ #:use-module (gnu home)
+ #:use-module (gnu home services)
#:use-module (gnu tests)
#:use-module (gnu system)
#:use-module (gnu system file-systems)
@@ -37,6 +39,7 @@
#:use-module (ice-9 match)
#:export (%test-guix-build-coordinator
%test-guix-data-service
+ %test-guix-home-service
%test-nar-herder
%test-bffe))
@@ -253,6 +256,76 @@ host all all ::1/128 trust"))))))
;;;
+;;; Guix Home
+;;;
+
+(define %guix-home-service-he
+ (home-environment
+ (services
+ (list (simple-service 'guix-home-service-test
+ home-files-service-type
+ `(("guix-home-service-activated"
+ ,(plain-file "guix-home-service-activated"
+ "Guix Home service activated"))))))))
+
+(define %guix-home-service-os
+ (simple-operating-system
+ (service guix-home-service-type
+ `(("alice" ,%guix-home-service-he)))))
+
+(define (run-guix-home-service-test)
+ (define os
+ (marionette-operating-system
+ %guix-home-service-os
+ #:imported-modules '((gnu services herd))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (memory-size 1024)))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-64)
+ (gnu build marionette))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (test-runner-current (system-test-runner #$output))
+ (test-begin "guix-home-service")
+
+ (test-assert "service started"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'guix-home-alice)
+ (#f #f)
+ ;; herd returns (running #f), likely because of one shot,
+ ;; so consider any non-error a success.
+ (('service response-parts ...) #t)))
+ marionette))
+
+ (test-assert "file-exists"
+ (marionette-eval
+ '(begin
+ (sleep 3) ;make sure service has time to symlink files
+ (file-exists? "/home/alice/guix-home-service-activated"))
+ marionette))
+
+ (test-end))))
+
+ (gexp->derivation "guix-home-service-test" test))
+
+(define %test-guix-home-service
+ (system-test
+ (name "guix-home-service")
+ (description "Activate a Guix home environment.")
+ (value (run-guix-home-service-test))))
+
+
+;;;
;;; Nar Herder
;;;