Previous: minimal example, Up: Guix extension [Contents][Index]
The explore.scm script can then be modified as follows to have it work
as a Guix extension rather than a script.
(→ 9 min 13 s into Simon Tournier presentation)
-#!/bin/sh
-exec "${GUILE:-guile}" -e "(@ (explore) guix-explore)" -s "$0" "$@"
-!#
-(define-module (explore) +(define-module (guix extensions explore)
…
#:use-module (guix ui) + #:use-module (guix scripts) #:use-module (guix store)
…
-(define (guix-explore args)
+(define-command (guix-explore . args)
+ (category extension)
+ (synopsis ``explore your service'')
(define %user-module @dots{}
…
Note on the path to the script: [It seems that] to be used as a guix extension, Guix requires a script to live under a “[/…]/guix/extensions[/…]/<module-name>.scm” tree structure with the corresponding module declaration
(define-module (guix extensions […] <module-name>) ….This will work :
$ pwd ~/tmp/10-years-of-guix/guix/extensions/test $ head -1 hello.scm (define-module (guix extensions test hello)… while this won’t work :
$ pwd ~/tmp/10-years-of-guix/guix/test $ head -1 hello.scm (define-module (guix test hello)… nor this :
$ pwd ~/tmp/10-years-of-guix/nono/ $ head -1 hello.scm (define-module (nono hello)
lauching
Note:
exploreproduces a visual and interactive representation of the services used in a OS declaration. The user has to provide a path to the OS configuration file to explore.
All set, explore can now be used as a Guix extension like so :
$ export GUIX_EXTENSIONS_PATH=/path/to/guix/extensions $ guix explore -- /path/to/configure.scm
Previous: minimal example, Up: Guix extension [Contents][Index]