Indent generated G-expression scripts
Published by Arun Isaac on
In other languages: தமிழ்
Tags: guix, software, scheme, lisp
Indent generated G-expression scripts with this trick to aid in debugging!
Quick tip!
Scripts generated from G-expressions (such as using program-file
or gexp->script
) often need to be inspected and debugged. But, they are written to the store as a gibberish tangled ball of parentheses. Indent them using guix-scheme-mode
in Emacs. guix-scheme-mode
is part of Emacs-Guix.
If you’re not an Emacs user, you’re not entirely out of luck. You can use this guile one-liner:
cat /gnu/store/…-foo | guile -c '(use-modules (ice-9 pretty-print) (srfi srfi-171)) (port-transduce (tmap pretty-print) rcons read)'
UPDATE on 24 September, 2025: I fixed the guile one-liner to read all S-expressions, not just the first one.