branch: elpa/nix-mode
commit 857d963d1e5d6dec1af5310efeeeb4bfb0564308
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
Add nix-system function
Used in nix-shell.el
---
nix.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/nix.el b/nix.el
index 6af9ea6f73..365c2c7bbf 100644
--- a/nix.el
+++ b/nix.el
@@ -51,6 +51,16 @@
:group 'nix
:type 'string)
+(defun nix-system ()
+ "Get the current system tuple."
+ (let ((stdout (generate-new-buffer "nix eval"))
+ result)
+ (call-process nix-executable nil (list stdout nil) nil
+ "eval" "--raw" "(builtins.currentSystem)")
+ (with-current-buffer stdout (setq result (buffer-string)))
+ (kill-buffer stdout)
+ result))
+
;;;###autoload
(defun nix-build (&optional attr dir)
"Run nix-build.