summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-12-13 23:37:03 +0100
committerLudovic Courtès <ludo@gnu.org>2025-01-16 22:32:11 +0100
commit0aa45f18543552f2396414ab130dab40f8969d27 (patch)
tree7e28f838a4689df6295e6860bc2e82cb8e04b315
parentf68060a10182f4ff02eebaa2c426124eb92f97d8 (diff)
home: Define ‘%base-home-services’.
* gnu/home.scm (%base-home-services): New variable. (<home-environment>)[services]: Change default to ‘%base-home-services’. * guix/scripts/home/import.scm (manifest+configuration-files->code): Use ‘%base-home-services’ by default. * tests/home-import.scm (match-home-environment-no-services) (match-home-environment-transformations) (match-home-environment-no-services-nor-packages) (match-home-environment-bash-service) (match-home-environment-bash-service-with-alias): Adjust accordingly. * doc/he-config-bare-bones.scm: Use ‘%base-home-services’. * doc/guix.texi (Declaring the Home Environment): Add index entry for ‘%base-home-services’. Change-Id: Id95ede62b97a976aad138bfc4b63fc0bdf37c7de
-rw-r--r--doc/guix.texi1
-rw-r--r--doc/he-config-bare-bones.scm27
-rw-r--r--gnu/home.scm11
-rw-r--r--guix/scripts/home/import.scm8
-rw-r--r--tests/home-import.scm40
5 files changed, 50 insertions, 37 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 01a2ca19d0a..be7472714cb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -46272,6 +46272,7 @@ it manually. (@pxref{Configuring the Shell}).
46272@end quotation 46272@end quotation
46273 46273
46274@findex home-environment 46274@findex home-environment
46275@vindex %base-home-services
46275@lisp 46276@lisp
46276@include he-config-bare-bones.scm 46277@include he-config-bare-bones.scm
46277@end lisp 46278@end lisp
diff --git a/doc/he-config-bare-bones.scm b/doc/he-config-bare-bones.scm
index f948d85277f..844d666110f 100644
--- a/doc/he-config-bare-bones.scm
+++ b/doc/he-config-bare-bones.scm
@@ -7,19 +7,20 @@
7 7
8 8
9(home-environment 9(home-environment
10 (packages (list htop)) 10 (packages (list htop))
11 (services 11 (services
12 (list 12 (append (list
13 (service home-bash-service-type 13 (service home-bash-service-type
14 (home-bash-configuration 14 (home-bash-configuration
15 (guix-defaults? #t) 15 (guix-defaults? #t)
16 (bash-profile (list (plain-file "bash-profile" "\ 16 (bash-profile (list (plain-file "bash-profile" "\
17export HISTFILE=$XDG_CACHE_HOME/.bash_history"))))) 17export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
18 18
19 (simple-service 'test-config 19 (simple-service 'test-config
20 home-xdg-configuration-files-service-type 20 home-xdg-configuration-files-service-type
21 (list `("test.conf" 21 (list `("test.conf"
22 ,(plain-file "tmp-file.txt" 22 ,(plain-file "tmp-file.txt"
23 "the content of 23 "the content of
24 ~/.config/test.conf"))))))) 24 ~/.config/test.conf")))))
25 %base-home-services)))
25 26
diff --git a/gnu/home.scm b/gnu/home.scm
index b390c8d5348..042d2e67de9 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -23,6 +23,7 @@
23 #:use-module (gnu home services shells) 23 #:use-module (gnu home services shells)
24 #:use-module (gnu home services xdg) 24 #:use-module (gnu home services xdg)
25 #:use-module (gnu home services fontutils) 25 #:use-module (gnu home services fontutils)
26 #:use-module (gnu home services admin)
26 #:use-module (gnu services) 27 #:use-module (gnu services)
27 #:use-module (guix records) 28 #:use-module (guix records)
28 #:use-module (guix diagnostics) 29 #:use-module (guix diagnostics)
@@ -43,7 +44,9 @@
43 44
44 home-environment-with-provenance 45 home-environment-with-provenance
45 46
46 home-generation-base)) 47 home-generation-base
48
49 %base-home-services))
47 50
48;;; Comment: 51;;; Comment:
49;;; 52;;;
@@ -67,7 +70,7 @@
67 this-home-environment))) 70 this-home-environment)))
68 71
69 (services home-environment-user-services 72 (services home-environment-user-services
70 (default '()) 73 (default %base-home-services)
71 (sanitize validate-service-list)) 74 (sanitize validate-service-list))
72 75
73 (location home-environment-location ; <location> 76 (location home-environment-location ; <location>
@@ -75,6 +78,10 @@
75 source-properties->location)) 78 source-properties->location))
76 (innate))) 79 (innate)))
77 80
81(define %base-home-services
82 ;; Non-essential but useful services to have by default.
83 '())
84
78(define (home-environment-default-essential-services he) 85(define (home-environment-default-essential-services he)
79 "Return the list of essential services for home environment." 86 "Return the list of essential services for home environment."
80 (list 87 (list
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index fd263c06997..15b4bc97982 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -1,7 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> 2;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
3;;; Copyright © 2021 Andrew Tropin <andrew@trop.in> 3;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
4;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org> 4;;; Copyright © 2021-2022, 2024 Ludovic Courtès <ludo@gnu.org>
5;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se> 5;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se>
6;;; Copyright © 2022 Antero Mejr <antero@mailbox.org> 6;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
7;;; 7;;;
@@ -160,7 +160,8 @@ user's files to CONFIGURATION-DIRECTORY; the generated sexp refers to them."
160 160
161 (home-environment 161 (home-environment
162 (packages ,packages) 162 (packages ,packages)
163 (services (list ,@services))))))) 163 (services (append (list ,@services)
164 %base-home-services)))))))
164 (('begin ('specifications->manifest packages)) 165 (('begin ('specifications->manifest packages))
165 (match (configurations+modules configuration-directory) 166 (match (configurations+modules configuration-directory)
166 (((services . modules) ...) 167 (((services . modules) ...)
@@ -183,7 +184,8 @@ user's files to CONFIGURATION-DIRECTORY; the generated sexp refers to them."
183 ,(comment (G_ "\ 184 ,(comment (G_ "\
184;; Below is the list of Home services. To search for available 185;; Below is the list of Home services. To search for available
185;; services, run 'guix home search KEYWORD' in a terminal.\n")) 186;; services, run 'guix home search KEYWORD' in a terminal.\n"))
186 (services (list ,@services))))))))) 187 (services (append (list ,@services)
188 %base-home-services)))))))))
187 189
188(define* (import-manifest 190(define* (import-manifest
189 manifest destination-directory 191 manifest destination-directory
diff --git a/tests/home-import.scm b/tests/home-import.scm
index 04b7b761569..57a3d62a72b 100644
--- a/tests/home-import.scm
+++ b/tests/home-import.scm
@@ -115,7 +115,7 @@ corresponding file."
115 ('specifications->packages 115 ('specifications->packages
116 ('list "guile@2.0.9" "gcc:lib" "glibc@2.19"))) 116 ('list "guile@2.0.9" "gcc:lib" "glibc@2.19")))
117 ('services 117 ('services
118 ('list))))) 118 ('append ('list) '%base-home-services)))))
119 119
120(define-home-environment-matcher match-home-environment-transformations 120(define-home-environment-matcher match-home-environment-transformations
121 ('begin 121 ('begin
@@ -131,7 +131,7 @@ corresponding file."
131 ('list (transform ('specification->package "guile@2.0.9")) 131 ('list (transform ('specification->package "guile@2.0.9"))
132 ('list ('specification->package "gcc") "lib") 132 ('list ('specification->package "gcc") "lib")
133 ('specification->package "glibc@2.19"))) 133 ('specification->package "glibc@2.19")))
134 ('services ('list))))) 134 ('services ('append ('list) '%base-home-services)))))
135 135
136(define-home-environment-matcher match-home-environment-no-services-nor-packages 136(define-home-environment-matcher match-home-environment-no-services-nor-packages
137 ('begin 137 ('begin
@@ -143,7 +143,7 @@ corresponding file."
143 ('packages 143 ('packages
144 ('specifications->packages ('list))) 144 ('specifications->packages ('list)))
145 ('services 145 ('services
146 ('list))))) 146 ('append ('list) '%base-home-services)))))
147 147
148(define-home-environment-matcher match-home-environment-bash-service 148(define-home-environment-matcher match-home-environment-bash-service
149 ('begin 149 ('begin
@@ -157,13 +157,14 @@ corresponding file."
157 ('packages 157 ('packages
158 ('specifications->packages ('list))) 158 ('specifications->packages ('list)))
159 ('services 159 ('services
160 ('list ('service 160 (append ('list ('service
161 'home-bash-service-type 161 'home-bash-service-type
162 ('home-bash-configuration 162 ('home-bash-configuration
163 ('aliases ('quote ())) 163 ('aliases ('quote ()))
164 ('bashrc 164 ('bashrc
165 ('list ('local-file "/tmp/guix-config/.bashrc" 165 ('list ('local-file "/tmp/guix-config/.bashrc"
166 "bashrc")))))))))) 166 "bashrc"))))))
167 '%base-home-services)))))
167 168
168(define-home-environment-matcher match-home-environment-bash-service-with-alias 169(define-home-environment-matcher match-home-environment-bash-service-with-alias
169 ('begin 170 ('begin
@@ -177,15 +178,16 @@ corresponding file."
177 ('packages 178 ('packages
178 ('specifications->packages ('list))) 179 ('specifications->packages ('list)))
179 ('services 180 ('services
180 ('list ('service 181 ('append ('list ('service
181 'home-bash-service-type 182 'home-bash-service-type
182 ('home-bash-configuration 183 ('home-bash-configuration
183 ('aliases 184 ('aliases
184 ('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"") 185 ('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"")
185 ("ls" . "ls -p")))) 186 ("ls" . "ls -p"))))
186 ('bashrc 187 ('bashrc
187 ('list ('local-file "/tmp/guix-config/.bashrc" 188 ('list ('local-file "/tmp/guix-config/.bashrc"
188 "bashrc")))))))))) 189 "bashrc"))))))
190 '%base-home-services)))))
189 191
190 192
191(test-assert "manifest->code: No services" 193(test-assert "manifest->code: No services"