What about modifying ‘guix’ package to make various "View graph" actions
in "M-x guix" work by default (without installing graphviz)?

>From fb077a89b89bb255b464fa21d4f1e715f86239bf Mon Sep 17 00:00:00 2001
From: Alex Kost <[email protected]>
Date: Thu, 15 Oct 2015 20:57:20 +0300
Subject: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.

* gnu/packages/package-management.scm (guix-devel)[arguments]: Add
  'patch-exec-paths' phase to set 'guix-dot-program' emacs variable.
---
 gnu/packages/package-management.scm | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8fbe5b3..08a72c5 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -189,18 +189,31 @@ the Nix package manager.")
                   "1zgjj5knpz3qbbqdjm4yh436bzfgasc6p0k3xnx58hfjd88mdsga"))
                 (file-name (string-append "guix-" version "-checkout"))))
       (arguments
-       (substitute-keyword-arguments (package-arguments guix-0.8.3)
-         ((#:phases phases)
-          `(modify-phases ,phases
-             (add-after
-              'unpack 'bootstrap
-              (lambda _
-                ;; Make sure 'msgmerge' can modify the PO files.
-                (for-each (lambda (po)
-                            (chmod po #o666))
-                          (find-files "." "\\.po$"))
-
-                (zero? (system* "sh" "bootstrap"))))))))
+       (let ((args `(#:modules ((guix build gnu-build-system)
+                                (guix build utils)
+                                (guix build emacs-utils))
+                     #:imported-modules (,@%gnu-build-system-modules
+                                         (guix build emacs-utils))
+                     ,@(package-arguments guix-0.8.3))))
+         (substitute-keyword-arguments args
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'unpack 'bootstrap
+                 (lambda _
+                   ;; Make sure 'msgmerge' can modify the PO files.
+                   (for-each (lambda (po)
+                               (chmod po #o666))
+                             (find-files "." "\\.po$"))
+                   (zero? (system* "sh" "bootstrap"))))
+               (add-before 'build 'patch-exec-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (let ((graphviz (assoc-ref inputs "graphviz"))
+                         (file "emacs/guix-external.el"))
+                     (chmod file #o644)
+                     (emacs-substitute-variables file
+                       ("guix-dot-program" (string-append graphviz
+                                                          "/bin/dot")))
+                     #t))))))))
       (native-inputs
        `(("autoconf" ,(autoconf-wrapper))
          ("automake" ,automake)
-- 
2.5.0

Reply via email to