about summary refs log tree commit diff
path: root/emacs/.emacs.d
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-03-06T11·22+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-03-06T18·45+0000
commit96ff26e5ca815aa738dd7e871e82ce1156982c3a (patch)
treef69ae6b208a5e1d1a73c80b4871fe045e3a1e00c /emacs/.emacs.d
parent2eb9259a1b11b133390bfc74c9de69cc31a21349 (diff)
Support nix/home-manager-switch
As a part of my plan to reduce my dependence on the shell, I defined an Elisp
function to call `home-manager switch` from `M-x`.
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r--emacs/.emacs.d/wpc/wpc-nix.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-nix.el b/emacs/.emacs.d/wpc/wpc-nix.el
index b259a66b8955..678bef33b4e2 100644
--- a/emacs/.emacs.d/wpc/wpc-nix.el
+++ b/emacs/.emacs.d/wpc/wpc-nix.el
@@ -29,6 +29,16 @@
                  "nix-env" "-f" "<briefcase>" "-iA" "emacs")
   (display-buffer "*nix-build/<briefcase/emacs>*"))
 
+(defun nix/home-manager-switch ()
+  "Use Nix to reconfigure the user environment."
+  (interactive)
+  (start-process "nix/home-manager-switch" "*nix/home-manager-switch*"
+                 "home-manager"
+                 "-I" (format "nixpkgs=%s" (f-expand "~/nixpkgs"))
+                 "-I" (format "home-manager=%s" (f-expand "~/home-manager"))
+                 "switch")
+  (display-buffer "*nix/home-manager-switch*"))
+
 (defun nix/sly-from-briefcase (attribute)
   "Start a Sly REPL configured with a Lisp matching a derivation
   from my monorepo.