maintenance/doc/guix-days-2020/perfect-setup.org

4.4 KiB

The Perfect Setup

The manual mentions a "Perfect Setup" which is a rather pompous title considering the many shortcomings it currently has! :)

Let's list the main pain points below and some suggestions on how to fix them.

Too Emacsy

Most tools for hacking Guix imply the use of Emacs. Even Guile-Studio is Emacs under the hood. This is the source of a few problems:

  • Emacs has a steep learning curve which may overwhelm newcomers and thus deter Guix adoption.
  • Non-Emacs users may want to stick to their favourite editor.

We need to work on integrating Guix with Vim, etc.

Emacs-guix.el does not work with channels

Recommended Emacs packages

We could add this to The Perfect Setup:

  • Magit
  • Yasnippet to automate the redaction of commit message. Add this to your Emacs config:

    (when (require 'yasnippet nil 'noerror)
      (yas-global-mode 1)
      (add-to-list 'yas-snippet-dirs
                   (expand-file-name "etc/snippets" "~/projects/guix")))
  • guix.el Try the development commands as well as the log modes.
  • Helm / Ivy with imenu (fixed in Emacs 27) to browse package definitions (fuzzy live search). Fix for Emacs <27 here: https://github.com/alezost/emacs-config
  • engine-mode.el to browse the mailing lists from Emacs:

    (defun engine-eww-function (url &optional _)
    (interactive)
    (eww url))
    
    (defengine guix-devel
    "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=guix-devel&submit=Search&query=%s"
    :keybinding "gud"
    :browser 'engine-eww-function)
    
    (defengine guix-help
    "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=help-guix&submit=Search!&query=%s"
    :keybinding "guh"
    :browser 'engine-eww-function)
  • debbugs.el to browse and apply patches from Emacs. Try debbugs-gnu-bugs to go to a given bug number directly. Also try debbugs-org and the following snippet:

    (defun guix-debbugs-gnu (&optional severities packages archivedp suppress tags)
    "Like `debbugs-gnu' but for the Guix project."
    (interactive)
    (let ((debbugs-gnu-default-packages '("guix-patches" "guix")))
      (if (called-interactively-p)
          (call-interactively 'debbugs-gnu)
        (debbugs-gnu severities packages archivedp suppress tags))))

    To apply patches, mark the corresponding emails then press press "|" (gnus-summary-pipe-output) and type cd ~/guix && git am (change the path as appropriate).

  • Geiser for Guile hacking. You need to tell Emacs to add the checkouts of Guix and the channels that you use in order to load hack a Guix-related module from the REPL.

    (dolist (dir '("~/projects/guix" "~/projects/my-guix-channel"))
      (when (file-directory-p dir)
        (add-to-list 'geiser-guile-load-path dir)))

    Geiser needs more work, in particular:

    https://gitlab.com/jaor/geiser/issues/293 https://gitlab.com/jaor/geiser/issues/294 https://gitlab.com/jaor/geiser/issues/295 https://gitlab.com/jaor/geiser/issues/296

    Something that many Guix hackers didn't seem to know: on error you can display the backtrace with all local values for all the frames with

    ,backtrace #:full? #t

    or

    ,bt #:full? #t

    It's cumbersome to write though and it would be nicer to implement https://gitlab.com/jaor/geiser/issues/295.

  • Paredit, Parinfer, Lispy, symex While paredit is the most famous package for enhanced Lisp editing, the other ones might be more modern and worth checking out. For instance, have a look at the demos for Lisp: https://github.com/abo-abo/lispy#demos

Configuration sharing hub

We don't really have a way of sharing Guix tips and configurations.

For now, all we have is

use-package.el Guix support

Currently Emacs' use-package.el installs from MELPA / ELPA when a package is missing. It would be nice to add a Guix backend so that the package is automatically installed to the given profile when missing.

Other considerations

Some remarks came up that are not directly related to the tooling.

Channel origin of a package

Currently there is no practical way to know from which channel a package comes. We would need to add another field to guix show and guix search.