branch: elpa/nix-mode
commit 6573b1d70e45371232373b73e773b01000b32753
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>

    Add nix-shell.el
---
 nix-shell.el | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/nix-shell.el b/nix-shell.el
new file mode 100644
index 0000000000..4ce523f402
--- /dev/null
+++ b/nix-shell.el
@@ -0,0 +1,33 @@
+;;; nix-shell.el -- run nix-shell in Emacs -*- lexical-binding: t -*-
+
+;; Author: Matthew Bauer <[email protected]>
+;; Homepage: https://github.com/matthewbauer/nix-mode
+;; Keywords: nix
+
+;; This file is NOT part of GNU Emacs.
+
+;;; Commentary:
+
+;;; Code:
+
+
+(require 'term)
+
+(defcustom nix-shell-executable "nix-shell"
+  "Location of nix-shell executable."
+  :group 'nix-mode)
+
+;;;###autoload
+(defun nix-shell (attribute)
+  "Run nix-shell in a terminal.
+
+ATTRIBUTE attribute name in nixpkgs to use."
+  (interactive (list (read-from-minibuffer "Attribute name: ")))
+  (set-buffer (make-term "nix-shell" nix-shell-executable nil
+                         "<nixpkgs>" "-A" attribute))
+  (term-mode)
+  (term-char-mode)
+  (switch-to-buffer "*nix-shell*"))
+
+(provide 'nix-shell)
+;;; nix-shell.el ends here

Reply via email to