branch: elpa/nix-mode
commit 097b7bb992077888960ebfd2d9092863d3821816
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
Add nix-build.el
---
nix-build.el | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/nix-build.el b/nix-build.el
new file mode 100644
index 0000000000..0bea996f4a
--- /dev/null
+++ b/nix-build.el
@@ -0,0 +1,33 @@
+;;; nix.el -- run nix commands in Emacs -*- lexical-binding: t -*-
+
+;; Author: Matthew Bauer <[email protected]>
+;; Homepage: https://github.com/NixOS/nix-mode
+;; Keywords: nix
+
+;; This file is NOT part of GNU Emacs.
+
+;;; Commentary:
+
+;; To use this just run:
+
+;; M-x RET nix-shell RET
+
+;; This will give you some
+
+;;; Code:
+
+(require 'nix)
+(require 'nix-search)
+
+(defun nix-build (&optional attr)
+ "Run nix-build in a compilation buffer."
+ (interactive (list (nix-search-read-attr "./.")))
+ (setq compile-command (format "%s -A '%s'" nix-build-executable attr))
+ (setq-default compilation-directory default-directory)
+ (compilation-start compile-command nil
+ (apply-partially (lambda (attr _)
+ (format "*nix-build*<%s>" attr))
+ attr)))
+
+(provide 'nix-build)
+;;; nix-build.el ends here