summary refs log tree commit diff
path: root/gnu/services.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-02 21:52:28 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-02 22:25:12 +0100
commitaf4c3fd5e37d477bffce167909fbc0776a860204 (patch)
treeb055a36138d5033d9acf64a1b4c86f968d0caa9b /gnu/services.scm
parentd62e201cfd0f1e48c14586489d0e2b80ce943d4f (diff)
downloadguix-af4c3fd5e37d477bffce167909fbc0776a860204.tar.gz
services: Add 'profile-service-type'.
* gnu/services.scm (packages->profile-entry): New procedure.
  (profile-service-type): New variable.
* gnu/system.scm (operating-system-directory-base-entries): Remove
  the "profile" entry.
  (essential-services): Add a PROFILE-SERVICE-TYPE instance.
  (operating-system-profile): Rewrite in terms of 'fold-services'.
* doc/guix.texi (Service Reference): Add 'profile-service-type'.
* doc/images/service-graph.dot: Likewise.
Diffstat (limited to 'gnu/services.scm')
-rw-r--r--gnu/services.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 8a66d453df..0e1c74bda8 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -21,6 +21,7 @@
   #:use-module (guix monads)
   #:use-module (guix store)
   #:use-module (guix records)
+  #:use-module (guix profiles)
   #:use-module (guix sets)
   #:use-module (guix ui)
   #:use-module (gnu packages base)
@@ -68,6 +69,7 @@
             etc-service-type
             etc-directory
             setuid-program-service-type
+            profile-service-type
             firmware-service-type
 
             %boot-service
@@ -414,6 +416,23 @@ FILES must be a list of name/file-like object pairs."
                 (compose concatenate)
                 (extend append)))
 
+(define (packages->profile-entry packages)
+  "Return a system entry for the profile containing PACKAGES."
+  (mlet %store-monad ((profile (profile-derivation
+                                (manifest (map package->manifest-entry
+                                               (delete-duplicates packages eq?))))))
+    (return `(("profile" ,profile)))))
+
+(define profile-service-type
+  ;; The service that populates the system's profile---i.e.,
+  ;; /run/current-system/profile.  It is extended by package lists.
+  (service-type (name 'profile)
+                (extensions
+                 (list (service-extension system-service-type
+                                          packages->profile-entry)))
+                (compose concatenate)
+                (extend append)))
+
 (define (firmware->activation-gexp firmware)
   "Return a gexp to make the packages listed in FIRMWARE loadable by the
 kernel."