Last-Modified: 2023-03-27T17:30:28+01:00 SPDX-License-Identifier: CC0-1.0 SPDX-FileCopyrightText: 2023 Bruno Victal Guix Development Cheats Miscellaneous collection of tricks. Crappy cheats for the Emacs+Geiser illiterate =========================================================================================== # Generating documentation for a define-configuration """Guix REPL""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" scheme@(guix-user)> ,m (gnu services ) scheme@(guix-user)> (with-output-to-file "/tmp/generated-doc.txt" (lambda () (configuration->documentation 'my-service-configuration))) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" G-Expression bestiary =========================================================================================== # Handling quoted lists (such as mcron time expressions) To “paste” a quoted list into a G-Expression: """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #~'(#$@variable) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" I should mention that the following snippet does not work: """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #$(if (list? schedule) `(list ,@schedule) schedule) ;; If schedule is defined as ;; ;; '(next-second (range 0 60 30)) ;; ;; then this is going to be ungexp'd as ;; ;; (list next-second (0 30)) ;; ;; Notice how only the first layer survived the quoting process. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" # Simple lists and procedures returning lists Place a quote before #~(…). This applies to procedures returning lists as well. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #~(… '#$(map func (list …))) #~(… '#$lst …) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" This is due to the list being processed and “pasted” as (a b c …) inside the G-Expression, which resembles a procedure call to `a' rather than a list. Guix internals =========================================================================================== # Get available system tests """GUIX repl""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" scheme@(guix-user)> ,use (guix profiles) scheme@(guix-user)> ,pp (map manifest-entry-name (manifest-entries (load "etc/system-tests.scm"))) Selected 114 system tests... $1 = ("test.mympd" "test.mpd" "test.linux-libre-4.14" "test.basic" ⋮ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""