diff options
| -rw-r--r-- | doc/guix.texi | 6 | ||||
| -rw-r--r-- | doc/images/service-graph.dot | 2 | ||||
| -rw-r--r-- | gnu/services.scm | 19 | ||||
| -rw-r--r-- | gnu/system.scm | 24 |
4 files changed, 41 insertions, 10 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 6ab98deef3a..897675291e0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -7899,6 +7899,12 @@ executable file names, passed as gexps, and adds them to the set of | |||
| 7899 | setuid-root programs on the system (@pxref{Setuid Programs}). | 7899 | setuid-root programs on the system (@pxref{Setuid Programs}). |
| 7900 | @end defvr | 7900 | @end defvr |
| 7901 | 7901 | ||
| 7902 | @defvr {Scheme Variable} profile-service-type | ||
| 7903 | Type of the service that populates the @dfn{system profile}---i.e., the | ||
| 7904 | programs under @file{/run/current-system/profile}. Other services can | ||
| 7905 | extend it by passing it lists of packages to add to the system profile. | ||
| 7906 | @end defvr | ||
| 7907 | |||
| 7902 | 7908 | ||
| 7903 | @node dmd Services | 7909 | @node dmd Services |
| 7904 | @subsubsection dmd Services | 7910 | @subsubsection dmd Services |
diff --git a/doc/images/service-graph.dot b/doc/images/service-graph.dot index 04f231bb098..b0840059847 100644 --- a/doc/images/service-graph.dot +++ b/doc/images/service-graph.dot | |||
| @@ -2,6 +2,7 @@ digraph "Service Type Dependencies" { | |||
| 2 | dmd [shape = box, fontname = Helvetica]; | 2 | dmd [shape = box, fontname = Helvetica]; |
| 3 | pam [shape = box, fontname = Helvetica]; | 3 | pam [shape = box, fontname = Helvetica]; |
| 4 | etc [shape = box, fontname = Helvetica]; | 4 | etc [shape = box, fontname = Helvetica]; |
| 5 | profile [shape = box, fontname = Helvetica]; | ||
| 5 | accounts [shape = box, fontname = Helvetica]; | 6 | accounts [shape = box, fontname = Helvetica]; |
| 6 | activation [shape = box, fontname = Helvetica]; | 7 | activation [shape = box, fontname = Helvetica]; |
| 7 | boot [shape = box, fontname = Helvetica]; | 8 | boot [shape = box, fontname = Helvetica]; |
| @@ -35,4 +36,5 @@ digraph "Service Type Dependencies" { | |||
| 35 | guix -> accounts; | 36 | guix -> accounts; |
| 36 | boot -> system; | 37 | boot -> system; |
| 37 | etc -> system; | 38 | etc -> system; |
| 39 | profile -> system; | ||
| 38 | } | 40 | } |
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 |
| 419 | kernel." | 438 | kernel." |
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 |
| 259 | value of the SYSTEM-SERVICE-TYPE service." | 259 | value 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 |
