From 96ff26e5ca815aa738dd7e871e82ce1156982c3a Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 6 Mar 2020 11:22:56 +0000 Subject: [PATCH] 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`. --- emacs/.emacs.d/wpc/wpc-nix.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/.emacs.d/wpc/wpc-nix.el b/emacs/.emacs.d/wpc/wpc-nix.el index b259a66b8..678bef33b 100644 --- a/emacs/.emacs.d/wpc/wpc-nix.el +++ b/emacs/.emacs.d/wpc/wpc-nix.el @@ -29,6 +29,16 @@ "nix-env" "-f" "" "-iA" "emacs") (display-buffer "*nix-build/*")) +(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.