about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/workstation/emacs/init.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/workstation/emacs/init.el b/modules/workstation/emacs/init.el
index f188a0b52f4f..bdfb1b9b155b 100644
--- a/modules/workstation/emacs/init.el
+++ b/modules/workstation/emacs/init.el
@@ -139,6 +139,15 @@
 ;; cross-references.
 (setq Man-notify-method 'pushy)
 
+;;; Nix support ;;;
+(defun browse-url-nixpkgs (attr)
+  "Open a browser to the homepage for the Nixpkgs attribute ATTR."
+  (interactive "sAttribute: ")
+  (let* ((full-attr-quoted (shell-quote-argument (concat attr ".meta.homepage")))
+	 (command (concat "nix eval --raw -f '<nixpkgs>' " full-attr-quoted))
+	 (homepage (shell-command-to-string command)))
+    (browse-url homepage)))
+
 ;;; Rainbow Delimiters ;;;
 (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)