Hacking Guix Home Services in the REPL

Updates

Hacking Guix Home Services in the REPL

Today I want to spend some time learning how to hack on Guix Home services in the Guile REPL so that I can build up a service without running guix home container a bunch of times!

(use-modules (guix store))

(let* ((server (open-connection))
       (path (add-text-to-store server "hello.txt" "Hello Guix!")))
  (display "The store path is: ")
  (display path)
  (newline)
  (close-connection server))

(build-derivations store derivations [mode]): Builds a list of derivations against the given store

(define (sh-symlink)
  (gexp->derivation "sh"
                    #~(symlink (string-append #$bash "/bin/bash")
                                #$output)))

(run-with-store (open-connection) (sh-symlink))
;; guix home -L ~/.dotfiles container test-config.scm

(use-modules (gnu home)
              (gnu services)
              (daviwil home-services emacs))

(home-environment
  (services (list (service home-emacs-service-type
                          (home-emacs-configuration
                            (modules (home-emacs-module-configuration
                                      (module-name "dw-core")
                                      ;; (variables '(("dw-core-use-something" . #t)))
                                      ))
                            (extra-init ";; Foo!"))))))

Notes

You can build a g-exp in the REPL by running the following command:

,build (scheme-file "test.scm" my-g-expr)

Enjoyed this stream? Explore our hands-on courses for deeper, structured learning on Guile Scheme and more.

Get the System Crafters Newsletter
Updates on open source tools, tutorials, and community projects. We'll also occasionally let you know about new courses and resources.
Name (optional)
Email Address