about summary refs log tree commit diff
path: root/tools/emacs-pkgs/nix-util/nix-util.el
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-01-17T12·23+0100
committersterni <sternenseemann@systemli.org>2022-01-17T15·02+0000
commit88eff2080cd38518cb216c0dbd3390f7c88a7873 (patch)
tree6cb6c676eabb53bd2b2dcc466ef569296ff088a0 /tools/emacs-pkgs/nix-util/nix-util.el
parent5f3918ba6b960b283b952a618205a46e133a64c3 (diff)
refactor(tools/emacs-pkgs): move sly-from-depot to tvl.el r/3622
The function is depot specific and thus uses tvl-depot-path, so it
belongs in `tvl.el`. Since non-sly-users won't need it, we tie its
definition to loading the sly package.

Change-Id: I8b104deab455d218d3df6a800e35cc104220a841
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4960
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tools/emacs-pkgs/nix-util/nix-util.el')
-rw-r--r--tools/emacs-pkgs/nix-util/nix-util.el35
1 files changed, 1 insertions, 34 deletions
diff --git a/tools/emacs-pkgs/nix-util/nix-util.el b/tools/emacs-pkgs/nix-util/nix-util.el
index 00b86e994e92..4ddc81f563d3 100644
--- a/tools/emacs-pkgs/nix-util/nix-util.el
+++ b/tools/emacs-pkgs/nix-util/nix-util.el
@@ -5,14 +5,13 @@
 ;;
 ;; Author: Vincent Ambo <tazjin@google.com>
 ;; Version: 1.0
-;; Package-Requires: (cl json map s)
+;; Package-Requires: (json map s)
 ;;
 ;;; Commentary:
 ;;
 ;; This package adds some functionality that I find useful when
 ;; working in Nix buffers or programs installed from Nix.
 
-(require 'cl)
 (require 'json)
 (require 'map)
 (require 's)
@@ -67,36 +66,4 @@
                   :stderr errbuf
                   :sentinel prefetch-handler)))
 
-(defun nix/sly-from-depot (attribute)
-  "Start a Sly REPL configured with a Lisp matching a derivation
-  from the depot.
-
-  The derivation invokes nix.buildLisp.sbclWith and is built
-  asynchronously. The build output is included in the error
-  thrown on build failures."
-
-  (interactive "sAttribute: ")
-  (lexical-let* ((outbuf (get-buffer-create (format "*depot-out/%s*" attribute)))
-                 (errbuf (get-buffer-create (format "*depot-errors/%s*" attribute)))
-                 (expression (format "(import <depot> {}).%s.repl" attribute))
-                 (command (list "nix-build" "--no-out-link" "-I" (format "depot=%s" tvl-depot-path) "-E" expression)))
-    (message "Acquiring Lisp for <depot>.%s" attribute)
-    (make-process :name (format "depot-nix-build/%s" attribute)
-                  :buffer outbuf
-                  :stderr errbuf
-                  :command command
-                  :sentinel
-                  (lambda (process event)
-                    (unwind-protect
-                        (pcase event
-                          ("finished\n"
-                           (let* ((outpath (s-trim (with-current-buffer outbuf (buffer-string))))
-                                  (lisp-path (s-concat outpath "/bin/sbcl")))
-                             (message "Acquired Lisp for <depot>.%s at %s" attribute lisp-path)
-                             (sly lisp-path)))
-                          (_ (with-current-buffer errbuf
-                               (error "Failed to build '%s':\n%s" attribute (buffer-string)))))
-                      (kill-buffer outbuf)
-                      (kill-buffer errbuf))))))
-
 (provide 'nix-util)