summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorXinglu Chen <public@yoctocell.xyz>2021-10-30 12:42:32 +0200
committerLudovic Courtès <ludo@gnu.org>2021-10-31 00:51:05 +0200
commite4d09d25ae6e4319c9eb1c78601af7007128a21e (patch)
treea0cd6fd9c06819a2a6db78ea90ffaf9d2342ff91 /guix/scripts
parentd5eb05f01ea59da8435e9df4f15835edbb31a30e (diff)
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>
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/home/import.scm34
1 files changed, 19 insertions, 15 deletions
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index c7c60e95e8..533abdbb8d 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -43,8 +43,7 @@
(let ((rc (destination-append ".bashrc"))
(profile (destination-append ".bash_profile"))
(logout (destination-append ".bash_logout")))
- `((gnu home-services bash)
- (service home-bash-service-type
+ `((service home-bash-service-type
(home-bash-configuration
,@(if (file-exists? rc)
`((bashrc
@@ -60,12 +59,15 @@
`((bash-logout
(list (slurp-file-gexp
(local-file ,logout)))))
- '()))))))
+ '())))
+ (gnu home-services bash))))
-(define %files-configurations-alist
- `((".bashrc" . ,generate-bash-module+configuration)
- (".bash_profile" . ,generate-bash-module+configuration)
- (".bash_logout" . ,generate-bash-module+configuration)))
+
+
+(define %files+configurations-alist
+ `((".bashrc" . ,generate-bash-configuration+modules)
+ (".bash_profile" . ,generate-bash-configuration+modules)
+ (".bash_logout" . ,generate-bash-configuration+modules)))
(define (configurations+modules destination-directory)
"Return a list of procedures which when called, generate code for a home
@@ -144,12 +146,13 @@ available."
(let ((configurations+modules
(configurations+modules destination-directory)))
`(begin
- (use-modules (gnu home)
- (gnu packages)
- ,@(map first modules+configurations))
- ,(home-environment-template
- #:specs specs
- #:services (map second modules+configurations))))
+ (use-modules (gnu home)
+ (gnu packages)
+ (gnu services)
+ ,@(concatenate (map cdr configurations+modules)))
+ ,(home-environment-template
+ #:specs specs
+ #:services (map first configurations+modules))))
`(begin
(use-modules (gnu packages))
@@ -190,13 +193,14 @@ available."
(use-modules (guix transformations)
(gnu home)
(gnu packages)
- ,@(map first modules+configurations))
+ (gnu services)
+ ,@(concatenate (map cdr configurations+modules)))
,@transformations
,(home-environment-template
#:packages packages
- #:services (map second modules+configurations))))
+ #:services (map first configurations+modules))))
`(begin
(use-modules (guix transformations)
(gnu packages))