me
/
guix
Archived
1
0
Fork 0

guix home: import: Allow multiple modules to be imported for each service.

Previously, only one module could be imported for each service, e.g., only
(gnu home-services shell) could be imported when generating the Bash service
declaration.  However, for some services, multiple modules might need to be
imported in order for it to work.

* guix/scripts/home/import.scm (generate-bash-module+configuration): Rename to
...
(generate-bash-configuration+modules): ... this.
(%files-configurations-alist): Rename to ...
(%files+configurations-alist): ... this.
(modules+configurations): Rename to ...
(configurations+modules): ... this.
(manifest->code): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
Xinglu Chen 2021-10-30 12:42:32 +02:00 committed by Ludovic Courtès
parent d5eb05f01e
commit e4d09d25ae
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 19 additions and 15 deletions

View File

@ -43,8 +43,7 @@
(let ((rc (destination-append ".bashrc")) (let ((rc (destination-append ".bashrc"))
(profile (destination-append ".bash_profile")) (profile (destination-append ".bash_profile"))
(logout (destination-append ".bash_logout"))) (logout (destination-append ".bash_logout")))
`((gnu home-services bash) `((service home-bash-service-type
(service home-bash-service-type
(home-bash-configuration (home-bash-configuration
,@(if (file-exists? rc) ,@(if (file-exists? rc)
`((bashrc `((bashrc
@ -60,12 +59,15 @@
`((bash-logout `((bash-logout
(list (slurp-file-gexp (list (slurp-file-gexp
(local-file ,logout))))) (local-file ,logout)))))
'())))))) '())))
(gnu home-services bash))))
(define %files-configurations-alist
`((".bashrc" . ,generate-bash-module+configuration)
(".bash_profile" . ,generate-bash-module+configuration) (define %files+configurations-alist
(".bash_logout" . ,generate-bash-module+configuration))) `((".bashrc" . ,generate-bash-configuration+modules)
(".bash_profile" . ,generate-bash-configuration+modules)
(".bash_logout" . ,generate-bash-configuration+modules)))
(define (configurations+modules destination-directory) (define (configurations+modules destination-directory)
"Return a list of procedures which when called, generate code for a home "Return a list of procedures which when called, generate code for a home
@ -144,12 +146,13 @@ available."
(let ((configurations+modules (let ((configurations+modules
(configurations+modules destination-directory))) (configurations+modules destination-directory)))
`(begin `(begin
(use-modules (gnu home) (use-modules (gnu home)
(gnu packages) (gnu packages)
,@(map first modules+configurations)) (gnu services)
,(home-environment-template ,@(concatenate (map cdr configurations+modules)))
#:specs specs ,(home-environment-template
#:services (map second modules+configurations)))) #:specs specs
#:services (map first configurations+modules))))
`(begin `(begin
(use-modules (gnu packages)) (use-modules (gnu packages))
@ -190,13 +193,14 @@ available."
(use-modules (guix transformations) (use-modules (guix transformations)
(gnu home) (gnu home)
(gnu packages) (gnu packages)
,@(map first modules+configurations)) (gnu services)
,@(concatenate (map cdr configurations+modules)))
,@transformations ,@transformations
,(home-environment-template ,(home-environment-template
#:packages packages #:packages packages
#:services (map second modules+configurations)))) #:services (map first configurations+modules))))
`(begin `(begin
(use-modules (guix transformations) (use-modules (guix transformations)
(gnu packages)) (gnu packages))