mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
9f8e92cc7d
commit
59bb53823e
4 changed files with 149 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2019, 2020, 2021, 2022 Christopher Baines <mail@cbaines.net>
|
||||
;;; Copyright © 2024 Andrew Tropin <andrew@trop.in>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -101,6 +102,8 @@
|
|||
|
||||
guix-data-service-type
|
||||
|
||||
guix-home-service-type
|
||||
|
||||
nar-herder-service-type
|
||||
nar-herder-configuration
|
||||
nar-herder-configuration?
|
||||
|
@ -686,6 +689,41 @@ ca-certificates.crt file in the system profile."
|
|||
(description
|
||||
"Run an instance of the Guix Data Service.")))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Guix Home Service
|
||||
;;;
|
||||
|
||||
(define (guix-home-shepherd-service config)
|
||||
(map (match-lambda
|
||||
((user he)
|
||||
(shepherd-service
|
||||
(documentation "Activate Guix Home.")
|
||||
(requirement '(user-processes))
|
||||
(provision (list (symbol-append 'guix-home- (string->symbol user))))
|
||||
(one-shot? #t)
|
||||
(auto-start? #t)
|
||||
(start #~(make-forkexec-constructor
|
||||
'(#$(file-append he "/activate"))
|
||||
#:user #$user
|
||||
#:environment-variables
|
||||
(list (string-append "HOME=" (passwd:dir (getpw #$user)))
|
||||
"GUIX_SYSTEM_IS_RUNNING_HOME_ACTIVATE=t")
|
||||
#:group (group:name (getgrgid (passwd:gid (getpw #$user))))))
|
||||
(stop #~(make-kill-destructor)))))
|
||||
config))
|
||||
|
||||
(define guix-home-service-type
|
||||
(service-type
|
||||
(name 'guix-home)
|
||||
(description "Sets up Guix Home for the specified user accounts.")
|
||||
(extensions (list (service-extension
|
||||
shepherd-root-service-type
|
||||
guix-home-shepherd-service)))
|
||||
(compose concatenate)
|
||||
(extend append)
|
||||
(default-value '())))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Nar Herder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue