emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode 93bfb4428d 182/500: Add nix-build function.


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 93bfb4428d 182/500: Add nix-build function.
Date: Sat, 29 Jan 2022 08:27:04 -0500 (EST)

branch: elpa/nix-mode
commit 93bfb4428de869f8dc3d1339fbaa5971ed83c5ef
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    Add nix-build function.
    
    I use this in nixpkgs a lot. Instead of a terminal just open a dired window 
and
    type:
    
    M-x nix-build
    
    followed by what attribute you want to build.
---
 nix-mode.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/nix-mode.el b/nix-mode.el
index 6f32252b93..27308320b3 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -464,6 +464,17 @@ STRING-TYPE type of string based off of Emacs syntax table 
types"
 
 (when (require 'mmm-mode nil 'noerror) (require 'nix-mode-mmm nil 'noerror))
 
+;;;###autoload
+(defun nix-build (&optional attr dir)
+  "Run nix-build.
+ATTR is the attribute to build.
+DIR is the directory containing the Nix default.nix expression."
+  (interactive "sNix attribute: ")
+  (unless dir (setq dir default-directory))
+  (if attr
+      (shell-command (format "nix-build %s -A %s" dir attr))
+    (shell-command (format "nix-build %s" dir))))
+
 ;;;###autoload
 (define-derived-mode nix-mode prog-mode "Nix"
   "Major mode for editing Nix expressions.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]