Next: Ludovic Courtès's explore.scm program, Up: Guix extension [Contents][Index]
As a minimal example of a guix extension, the following file,
~/tmp/10-years-of-guix/guix/extensions/hello.scm, is used :
(define-module (guix extensions hello)
#:export (guix-hello))
(define-command (guix-hello . cmd-line)
(category plumbing)
(synopsis "hello world")
(display (G_ "hello folks!")))
The environment variable GUIX_EXTENSIONS_PATH has to include the
path to the scrip file.
With this in place, we can see the hello extension integrated in
the guix CLI, as the following capture shows, with the new
command “hello” added to the “plumbing” category :
$ export GUIX_EXTENSIONS_PATH="$HOME/tmp/10-years-of-guix/guix/extensions"
$ guix help
Usage: guix OPTION | COMMAND ARGS...
Run COMMAND with ARGS, if given.
# [skipping for clarity …]
plumbing commands
archive manipulate, export, and import normalized archives (nars)
copy copy store items remotely over SSH
git operate on Git repositories
offload set up and operate build offloading
processes list currently running sessions
repl read-eval-print loop (REPL) for interactive programming
hello hello world
Report bugs to: bug-guix@gnu.org.
# …