unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: "Thompson, David" <dthompson2@worcester.edu>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Emacs integration for 'guix shell'
Date: Wed, 28 Sep 2022 10:36:12 +0300	[thread overview]
Message-ID: <YzP5bGkXGBdWSUfm@3900XT> (raw)
In-Reply-To: <CAJ=RwfbsGuwY3-zxnkPUDOZ4vR9gWjgt3eb0RD9=+TA2tGNgRQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2816 bytes --]

On Mon, Sep 26, 2022 at 01:48:25PM -0400, Thompson, David wrote:
> Hello all,
> 
> I recently wrote a little blog post titled "Guix for development" [0]
> and in it I mentioned using a tool called direnv and emacs-direnv as a
> way to integrate 'guix shell' with Emacs. This integration has vastly
> improved my Emacs experience. I can open a shell buffer and the
> environment variables are automatically configured the way I want. I
> can run M-x compile and simply enter 'make' as the command instead of
> 'guix shell -D -f guix.scm -- make'.
> 
> It's very cool that it works, and I should have done this years ago,
> but direnv is an unnecessary middleman for me because I don't use it
> for any other purpose.  It would be *even cooler* if Emacs could call
> 'guix shell --search-paths' directly, parse the result, and update the
> buffer environment.  Furthemore, it could integrate with project.el
> (thus requiring Emacs 28) so that per-project search paths "just
> work." The emacs-guix-shell [1] project attempts to do this.
> 
> I'm not an experienced elisp programmer so I'm sure there's stuff to
> fix, and there are no customizable variables yet, but the essentials
> seem to work OK for me.  If you'd like to try it out, eval
> guix-shell.el and then M-x guix-shell-global-mode to enable it
> everywhere, or M-x guix-shell-mode to enable it just for the current
> buffer.
> 
> Whether through direnv or guix-shell.el, integrating Emacs with 'guix
> shell' has been a game changer for my development workflow and I
> highly recommend it!
> 
> That's all for now,
> 
> - Dave
> 
> [0] https://dthompson.us/guix-for-development.html
> [1] https://git.dthompson.us/emacs-guix-shell.git/

You can add other things to your guix.scm file, allowing you to do More
Things™ than just add packages to your environment.

I'm currently using Enlightenment, which has a 'PANTS=ON' environment
variable for unknown reasons.

(ins)efraim@3900XT ~$ cat guix-shell.scm
;; This creates and empty guix environment, with
;; the PANTS environment variable set to OFF.

(setenv "PANTS" "OFF")
(list )
(ins)efraim@3900XT ~$ env | grep PANTS
PANTS=ON
(ins)efraim@3900XT ~$ guix shell -f guix-shell.scm
guix shell: warning: no packages specified; creating an empty environment
(ins)efraim@3900XT ~ [env]$ env | grep PANTS
PANTS=ON

This doesn't directly help with your scenario, but you could change your
'make' invocation to `guix shell -D -f guix.scm -- sh -c 'source
$GUIX_ENVIRONMENT/etc/profile; make'`, which would work as a workaround
for now.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2022-09-28  9:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 17:48 Emacs integration for 'guix shell' Thompson, David
2022-09-26 18:30 ` Olivier Dion via Development of GNU Guix and the GNU System distribution.
2022-09-27  2:44   ` Maxim Cournoyer
2022-09-27 11:13     ` Thompson, David
2022-09-28 14:11       ` Maxim Cournoyer
2022-09-27  9:15   ` zimoun
2022-09-27 12:06     ` Olivier Dion via Development of GNU Guix and the GNU System distribution.
2022-09-27 14:39       ` zimoun
2022-09-26 18:58 ` pinoaffe
2022-09-28  7:36 ` Efraim Flashner [this message]
2022-09-28 12:42   ` Efraim Flashner
2022-10-01  4:47 ` James Thomas
2022-10-01  8:22 ` Philip Kaludercic
2022-10-01 11:58   ` Thompson, David
2022-10-01 14:38     ` Philip Kaludercic
2022-12-06 14:59       ` [EXT] " Thompson, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YzP5bGkXGBdWSUfm@3900XT \
    --to=efraim@flashner.co.il \
    --cc=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).