diff mbox series

[bug#46560,1/2] gnu: services: Add activate script to the profile system directory.

Message ID 20210216132235.15811-1-brice@waegenei.re
State Accepted
Headers show
Series Activate system when switching generations. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Brice Waegeneire Feb. 16, 2021, 1:22 p.m. UTC
* gnu/services.scm (activation-profile-entry): New procedure...
(activation-service-type): ... use it.
---
 gnu/services.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Ludovic Courtès March 1, 2021, 3:55 p.m. UTC | #1
Hi,

Brice Waegeneire <brice@waegenei.re> skribis:

> * gnu/services.scm (activation-profile-entry): New procedure...
> (activation-service-type): ... use it.

[...]

> +(define (activation-profile-entry gexps)
> +  "Return, as a monadic value, an entry for the activation script in the
> +system directory."
> +  (mlet %store-monad ((activate (lower-object (activation-script gexps))))
> +    (return `(("activate" ,activate)))))
> +
>  (define (second-argument a b) b)
>  
>  (define activation-service-type
>    (service-type (name 'activate)
>                  (extensions
>                   (list (service-extension boot-service-type
> -                                          gexps->activation-gexp)))
> +                                          gexps->activation-gexp)
> +                       (service-extension system-service-type
> +                                          activation-profile-entry)))

Good idea, LGTM!
diff mbox series

Patch

diff --git a/gnu/services.scm b/gnu/services.scm
index 13259dfaee..ddd1bac30c 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -617,13 +617,21 @@  ACTIVATION-SCRIPT-TYPE."
   "Return a gexp that runs the activation script containing GEXPS."
   #~(primitive-load #$(activation-script gexps)))
 
+(define (activation-profile-entry gexps)
+  "Return, as a monadic value, an entry for the activation script in the
+system directory."
+  (mlet %store-monad ((activate (lower-object (activation-script gexps))))
+    (return `(("activate" ,activate)))))
+
 (define (second-argument a b) b)
 
 (define activation-service-type
   (service-type (name 'activate)
                 (extensions
                  (list (service-extension boot-service-type
-                                          gexps->activation-gexp)))
+                                          gexps->activation-gexp)
+                       (service-extension system-service-type
+                                          activation-profile-entry)))
                 (compose identity)
                 (extend second-argument)
                 (description