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

    Add nix-unpack command.
---
 nix-shell.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/nix-shell.el b/nix-shell.el
index 0cd1108496..e500692f68 100644
--- a/nix-shell.el
+++ b/nix-shell.el
@@ -43,5 +43,17 @@ ATTRIBUTE attribute name in nixpkgs to use."
   (term-char-mode)
   (switch-to-buffer "*nix-shell*"))
 
+;;;###autoload
+(defun nix-unpack (path attribute)
+  "Get source from a Nix derivation.
+
+PATH used for base of Nix expresions.
+
+ATTRIBUTE from PATH to get Nix expressions from."
+  (interactive (list (read-string "Nix path: " "<nixpkgs>")
+                                        (read-string "Nix attribute name: ")))
+  (async-shell-command (format "%s '%s' -A '%s' --run unpackPhase"
+                                                          nix-shell-executable 
dir attribute)))
+
 (provide 'nix-shell)
 ;;; nix-shell.el ends here

Reply via email to