summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services.scm19
-rw-r--r--gnu/system.scm24
2 files changed, 33 insertions, 10 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 8a66d453dfd..0e1c74bda8d 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -21,6 +21,7 @@
21 #:use-module (guix monads) 21 #:use-module (guix monads)
22 #:use-module (guix store) 22 #:use-module (guix store)
23 #:use-module (guix records) 23 #:use-module (guix records)
24 #:use-module (guix profiles)
24 #:use-module (guix sets) 25 #:use-module (guix sets)
25 #:use-module (guix ui) 26 #:use-module (guix ui)
26 #:use-module (gnu packages base) 27 #:use-module (gnu packages base)
@@ -68,6 +69,7 @@
68 etc-service-type 69 etc-service-type
69 etc-directory 70 etc-directory
70 setuid-program-service-type 71 setuid-program-service-type
72 profile-service-type
71 firmware-service-type 73 firmware-service-type
72 74
73 %boot-service 75 %boot-service
@@ -414,6 +416,23 @@ FILES must be a list of name/file-like object pairs."
414 (compose concatenate) 416 (compose concatenate)
415 (extend append))) 417 (extend append)))
416 418
419(define (packages->profile-entry packages)
420 "Return a system entry for the profile containing PACKAGES."
421 (mlet %store-monad ((profile (profile-derivation
422 (manifest (map package->manifest-entry
423 (delete-duplicates packages eq?))))))
424 (return `(("profile" ,profile)))))
425
426(define profile-service-type
427 ;; The service that populates the system's profile---i.e.,
428 ;; /run/current-system/profile. It is extended by package lists.
429 (service-type (name 'profile)
430 (extensions
431 (list (service-extension system-service-type
432 packages->profile-entry)))
433 (compose concatenate)
434 (extend append)))
435
417(define (firmware->activation-gexp firmware) 436(define (firmware->activation-gexp firmware)
418 "Return a gexp to make the packages listed in FIRMWARE loadable by the 437 "Return a gexp to make the packages listed in FIRMWARE loadable by the
419kernel." 438kernel."
diff --git a/gnu/system.scm b/gnu/system.scm
index c26d27028b0..85a596ddb98 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -257,11 +257,9 @@ from the initrd."
257(define* (operating-system-directory-base-entries os #:key container?) 257(define* (operating-system-directory-base-entries os #:key container?)
258 "Return the basic entries of the 'system' directory of OS for use as the 258 "Return the basic entries of the 'system' directory of OS for use as the
259value of the SYSTEM-SERVICE-TYPE service." 259value of the SYSTEM-SERVICE-TYPE service."
260 (mlet* %store-monad ((profile (operating-system-profile os)) 260 (mlet %store-monad ((locale (operating-system-locale-directory os)))
261 (locale (operating-system-locale-directory os)))
262 (if container? 261 (if container?
263 (return `(("profile" ,profile) 262 (return `(("locale" ,locale)))
264 ("locale" ,locale)))
265 (mlet %store-monad 263 (mlet %store-monad
266 ((kernel -> (operating-system-kernel os)) 264 ((kernel -> (operating-system-kernel os))
267 (initrd (operating-system-initrd-file os)) 265 (initrd (operating-system-initrd-file os))
@@ -269,7 +267,6 @@ value of the SYSTEM-SERVICE-TYPE service."
269 (return `(("kernel" ,kernel) 267 (return `(("kernel" ,kernel)
270 ("parameters" ,params) 268 ("parameters" ,params)
271 ("initrd" ,initrd) 269 ("initrd" ,initrd)
272 ("profile" ,profile)
273 ("locale" ,locale))))))) ;used by libc 270 ("locale" ,locale))))))) ;used by libc
274 271
275(define* (essential-services os #:key container?) 272(define* (essential-services os #:key container?)
@@ -305,6 +302,8 @@ a container or that of a \"bare metal\" system."
305 host-name procs root-fs unmount 302 host-name procs root-fs unmount
306 (service setuid-program-service-type 303 (service setuid-program-service-type
307 (operating-system-setuid-programs os)) 304 (operating-system-setuid-programs os))
305 (service profile-service-type
306 (operating-system-packages os))
308 (append other-fs mappings swaps 307 (append other-fs mappings swaps
309 308
310 ;; Add the firmware service, unless we are building for a 309 ;; Add the firmware service, unless we are building for a
@@ -534,11 +533,6 @@ fi\n")))
534 #$(operating-system-timezone os))) 533 #$(operating-system-timezone os)))
535 ("sudoers" ,(operating-system-sudoers-file os)))))) 534 ("sudoers" ,(operating-system-sudoers-file os))))))
536 535
537(define (operating-system-profile os)
538 "Return a derivation that builds the system profile of OS."
539 (profile-derivation (manifest (map package->manifest-entry
540 (operating-system-packages os)))))
541
542(define %root-account 536(define %root-account
543 ;; Default root account. 537 ;; Default root account.
544 (user-account 538 (user-account
@@ -639,6 +633,16 @@ hardware-related operations as necessary when booting a Linux container."
639 ;; SYSTEM contains the derivation as a monadic value. 633 ;; SYSTEM contains the derivation as a monadic value.
640 (service-parameters system))) 634 (service-parameters system)))
641 635
636(define* (operating-system-profile os #:key container?)
637 "Return a derivation that builds the system profile of OS."
638 (mlet* %store-monad
639 ((services -> (operating-system-services os #:container? container?))
640 (profile (fold-services services
641 #:target-type profile-service-type)))
642 (match profile
643 (("profile" profile)
644 (return profile)))))
645
642(define (operating-system-root-file-system os) 646(define (operating-system-root-file-system os)
643 "Return the root file system of OS." 647 "Return the root file system of OS."
644 (find (match-lambda 648 (find (match-lambda