From 044259e9319e5d130ec5c5e748c631b73a693d2b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 23 Sep 2022 18:19:53 -0400 Subject: Update guix-for-dev post. --- posts/2022-09-23-guix-for-dev.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'posts') diff --git a/posts/2022-09-23-guix-for-dev.md b/posts/2022-09-23-guix-for-dev.md index 3f92c62..a255be6 100644 --- a/posts/2022-09-23-guix-for-dev.md +++ b/posts/2022-09-23-guix-for-dev.md @@ -160,12 +160,20 @@ host system is inaccessible. I rarely use either flag. `guix shell` runs pretty fast after it downloads all the required software the first time, and it can be run non-interactively, so it's -pretty handy to use in scripts. I like to use it with Emacs' -compilation feature. I run `M-x compile` and use `guix shell -D -f -guix.scm -- make` as the compilation command to run `make` in the -proper context. When running `guix shell` non-interactively, it must -be made explicit that `guix.scm` should be loaded (a minor usability -issue, IMO.) +pretty handy to use in scripts. It can even be used with +[direnv](https://direnv.net/) by adding this to `.envrc`: + +``` +eval $(guix shell --search-paths) +``` + +I'm an Emacs user, so I want to integrate `guix shell` there, as well. +Turns out that's pretty easy via the +[emacs-direnv](https://github.com/wbolster/emacs-direnv) extension. +With `direnv-mode` enabled, I can run `M-x compile`, enter `make` as +the compilation command, and build my project from within Emacs using +the environment built by `guix shell`. Pretty fancy! Thanks to +Andrew Whatson for teaching me about this. The same `guix.scm` file can be used with more than just `guix shell`. For example, `guix build -f guix.scm` will build the project from -- cgit v1.2.3