* Emacs integration for 'guix shell'
@ 2022-09-26 17:48 Thompson, David
2022-09-26 18:30 ` Olivier Dion via Development of GNU Guix and the GNU System distribution.
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Thompson, David @ 2022-09-26 17:48 UTC (permalink / raw)
To: guix-devel
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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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 9:15 ` zimoun
2022-09-26 18:58 ` pinoaffe
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Olivier Dion via Development of GNU Guix and the GNU System distribution. @ 2022-09-26 18:30 UTC (permalink / raw)
To: Thompson, David, guix-devel
On Mon, 26 Sep 2022, "Thompson, David" <dthompson2@worcester.edu> 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.
Interesting I'll have a look at it!
> 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.
I have the following in my .dir-locals.el for my library libpatch. The
idea is the same, but without direnv:
--8<---------------cut here---------------start------------->8---
((nil
. ((eval .
(let ((root (locate-dominating-file
default-directory ".dir-locals.el")))
(when root
(let ((real-root (directory-file-name (expand-file-name root))))
(setq-local geiser-guile-binary (concat real-root "/.geiser-guile"))
(setq-local projectile-project-compilation-cmd
(concat real-root "/.projectile-compile"))
(setq-local projectile-project-test-cmd
(concat real-root "/.projectile-test")))))))))
--8<---------------cut here---------------end--------------->8---
.projectile-compile:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
./dev-env make -j $(nproc)
--8<---------------cut here---------------end--------------->8---
.projectile-test:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
./dev-env make -j $(nproc) check-nocolor
--8<---------------cut here---------------end--------------->8---
.geiser-guile:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
here=$(pwd)
./dev-env guile -L "$here" -x "$here" $@
--8<---------------cut here---------------end--------------->8---
dev-env:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
guix shell \
--pure \
dyninst \
gdb \
git \
guix \
lcov \
guile-quickcheck \
perf \
lttng-ust \
lttng-tools \
--development libpatch \
-- $@
--8<---------------cut here---------------end--------------->8---
Note the latest script where I have development packages for libpatch,
but also other utitilies that are good to have for developer.
Regards,
old
--
Olivier Dion
oldiob.dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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-26 18:58 ` pinoaffe
2022-09-28 7:36 ` Efraim Flashner
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: pinoaffe @ 2022-09-26 18:58 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
Hi!
This looks like a really nice script!
A while back, I wrote a bit of elisp that does some of the same stuff
that your program does, but which is aimed at a workflow based on profiles
rather than on `guix shell`, see [0].
I have previously used said script to set up directory-specific
paths/environment variables, but currently I only use it to globally
enable/disable certain profiles at runtime.
Back when I wrote it, I was planning on rewriting it and integrating it
into emacs-guix, but I never got around to it. In general, it would be
nice to refactor it to use emacs-guix's `guix-repl' function rather than
manually running shell commands.
A caveat of my script: it sets the `load-path` variable, which is useful
at times but greatly increases the foot-shoot-ability.
Kind regards,
pinoaffe
[0] https://git.pixie.town/pinoaffe/emacs-config/src/branch/master/lisp/guix-profile-manager.el
"Thompson, David" <dthompson2@worcester.edu> writes:
> 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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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-27 9:15 ` zimoun
1 sibling, 1 reply; 16+ messages in thread
From: Maxim Cournoyer @ 2022-09-27 2:44 UTC (permalink / raw)
To: Olivier Dion via Development of GNU Guix and the GNU System distribution.
Cc: Thompson, David, Olivier Dion
Hi,
Olivier Dion via "Development of GNU Guix and the GNU System
distribution." <guix-devel@gnu.org> writes:
[...]
> I have the following in my .dir-locals.el for my library libpatch. The
> idea is the same, but without direnv:
>
> ((nil
> . ((eval .
> (let ((root (locate-dominating-file
> default-directory ".dir-locals.el")))
> (when root
> (let ((real-root (directory-file-name (expand-file-name root))))
> (setq-local geiser-guile-binary (concat real-root "/.geiser-guile"))
> (setq-local projectile-project-compilation-cmd
> (concat real-root "/.projectile-compile"))
> (setq-local projectile-project-test-cmd
> (concat real-root "/.projectile-test")))))))))
>
It seems to me it'd help everyone if Geiser should handle the above by
itself. It'd be cool to have the above functionality merged into Geiser
itelf. Just saying; thank you for sharing!
Maxim
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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 9:15 ` zimoun
2022-09-27 12:06 ` Olivier Dion via Development of GNU Guix and the GNU System distribution.
1 sibling, 1 reply; 16+ messages in thread
From: zimoun @ 2022-09-27 9:15 UTC (permalink / raw)
To: Olivier Dion, Thompson, David, guix-devel
Hi,
Thanks for sharing.
On Mon, 26 Sep 2022 at 14:30, Olivier Dion via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org> wrote:
> dev-env:
> --8<---------------cut here---------------start------------->8---
> #!/bin/sh
> guix shell \
> --pure \
> dyninst \
> gdb \
> git \
> guix \
> lcov \
> guile-quickcheck \
> perf \
> lttng-ust \
> lttng-tools \
> --development libpatch \
> -- $@
> --8<---------------cut here---------------end--------------->8---
>
> Note the latest script where I have development packages for libpatch,
> but also other utitilies that are good to have for developer.
Well, I am not happy with my workflow but I have something similar for
some projects. However, instead of this list, I have a “general” script
(named guixify) under ~/.local/bin/ which roughly reads:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
guix time-machine -C channels.scm \
-- shell --pure \
-m manifest.scm \
-- $@
--8<---------------cut here---------------end--------------->8---
where manifest.scm and channels.scm are kept with the Git project. I
prefer to pin a specific Guix revision to avoid bad surprises. :-) Well,
in a project, I just run:
guixify make # run make using the Guix environment
guixify # enter in the environment
I thought to write an extension but I am not convinced by the interface
I want. :-)
Cheers,
simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-27 2:44 ` Maxim Cournoyer
@ 2022-09-27 11:13 ` Thompson, David
2022-09-28 14:11 ` Maxim Cournoyer
0 siblings, 1 reply; 16+ messages in thread
From: Thompson, David @ 2022-09-27 11:13 UTC (permalink / raw)
To: Maxim Cournoyer
Cc: Olivier Dion via Development of GNU Guix and the GNU System distribution.,
Olivier Dion
On Mon, Sep 26, 2022 at 10:44 PM Maxim Cournoyer
<maxim.cournoyer@gmail.com> wrote:
>
> Hi,
>
> Olivier Dion via "Development of GNU Guix and the GNU System
> distribution." <guix-devel@gnu.org> writes:
>
> [...]
>
> > I have the following in my .dir-locals.el for my library libpatch. The
> > idea is the same, but without direnv:
> >
> > ((nil
> > . ((eval .
> > (let ((root (locate-dominating-file
> > default-directory ".dir-locals.el")))
> > (when root
> > (let ((real-root (directory-file-name (expand-file-name root))))
> > (setq-local geiser-guile-binary (concat real-root "/.geiser-guile"))
> > (setq-local projectile-project-compilation-cmd
> > (concat real-root "/.projectile-compile"))
> > (setq-local projectile-project-test-cmd
> > (concat real-root "/.projectile-test")))))))))
> >
>
> It seems to me it'd help everyone if Geiser should handle the above by
> itself. It'd be cool to have the above functionality merged into Geiser
> itelf. Just saying; thank you for sharing!
With Emacs 28 and new versions of Geiser (such as the one in Guix) I
highly recommend enabling per-project REPLs. By setting
geiser-repl-per-project-p to 't', commands like M-x run-guile and C-c
C-a will open/switch to a REPL associated with the current project as
determined by project.el. This is useful for when you are working on
multiple projects at once as it makes it harder to mix up REPLs, but
Geiser also automatically inserts the project root directory into
Guile's load path. When combined with emacs-direnv, emacs-envrc,
emacs-buffer-env, or emacs-guix-shell, the Guile binary that Geiser
uses when launching a per-project REPL will be the one from the 'guix
shell' profile, and it will honor the
GUILE_LOAD_PATH/GUILE_LOAD_COMPILED_PATH settings. So now, at long
last, my Geiser REPLs automatically use the proper build of Guile, it
can load the external libraries my project depends on, *and* it can
load my local project modules. I'm quite happy with this setup.
Maybe I could write a blog post specifically about setting up a Guile
development environment with Guix and include all these details.
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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
0 siblings, 1 reply; 16+ messages in thread
From: Olivier Dion via Development of GNU Guix and the GNU System distribution. @ 2022-09-27 12:06 UTC (permalink / raw)
To: zimoun, Thompson, David, guix-devel
On Tue, 27 Sep 2022, zimoun <zimon.toutoune@gmail.com> wrote:
>
> --8<---------------cut here---------------start------------->8---
> #!/bin/sh
>
> guix time-machine -C channels.scm \
> -- shell --pure \
> -m manifest.scm \
> -- $@
> --8<---------------cut here---------------end--------------->8---
How about:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
guix time-machine -C channels.scm \
-- shell --pure \
--development $(basename $(pwd)) \
-- $@
--8<---------------cut here---------------end--------------->8---
Of course you need to A) have a channels.scm in your project and B) have
your project directory named after the package's name in your channel.
> where manifest.scm and channels.scm are kept with the Git project. I
> prefer to pin a specific Guix revision to avoid bad surprises. :-) Well,
> in a project, I just run:
>
> guixify make # run make using the Guix environment
> guixify # enter in the environment
>
>
> I thought to write an extension but I am not convinced by the interface
> I want. :-)
I was using channel too before! It felt good to pin dependencies to a
version so it does not break while you're developing. Howeverff, I felt
that the time-machine was taking enormous time everytime a push was made
to a channel.
My biggest usage of the channel was to have the definition of my package
before it was merged into Guix channel. But this could also be used for
a development version that differs.
--
Olivier Dion
oldiob.dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-27 12:06 ` Olivier Dion via Development of GNU Guix and the GNU System distribution.
@ 2022-09-27 14:39 ` zimoun
0 siblings, 0 replies; 16+ messages in thread
From: zimoun @ 2022-09-27 14:39 UTC (permalink / raw)
To: Olivier Dion, Thompson, David, guix-devel
Hi,
On Tue, 27 Sep 2022 at 08:06, Olivier Dion via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org> wrote:
> --8<---------------cut here---------------start------------->8---
> #!/bin/sh
> guix time-machine -C channels.scm \
> -- shell --pure \
> --development $(basename $(pwd)) \
> -- $@
> --8<---------------cut here---------------end--------------->8---
>
> Of course you need to A) have a channels.scm in your project and B) have
> your project directory named after the package's name in your
> channel.
Personally, I prefer the ’-m manifest.scm’ approach. Or maybe the ’-f
guix.scm’ approach.
Because I use ’guixify’ for more than just “developing“. I mean
sometimes the manifest is just a list of packages, sometimes it contains
some development dependencies, sometimes some extra package definition,
etc.
Then this file manifest.scm or guix.scm is part of the project, i.e.,
included in the Git tree of the project. I can re-use it for ‘guix pack
-f docker -m mnifest.scm’ and generate a Docker pack for colleagues. I
can use it for ‘guix weather’ and know if the substitutes are there
before upgrading. Etc.
> I was using channel too before! It felt good to pin dependencies to a
> version so it does not break while you're developing. Howeverff, I felt
> that the time-machine was taking enormous time everytime a push was made
> to a channel.
It is because you are not using a pinned channel and instead following
the HEAD of some channels.
Because if you store:
guix describe -f channels.scm > channels.scm
then the first time you can ‘guix time-machine -C channels.scm’ I agree
it can take some time (because a compute derivation). But then, each
new invocation should be faster because it is cached.
However, indeed it is possible that ‘guix gc’ cleans up the temporary
profile; depending on how often you are working inside this project
environment.
To avoid this issue, sometime I create a profile inside the project
directory,
guix time-machine -C channels.scm \
-- package -m manifest.scm \
-p profile
then sometime I run ‘guix package --search-paths -p profile’; using some
options of search-paths as prefix, suffix or exact.
Well, the point with this profile is to protect against garbage
collection; although it is not a bullet-proof protection. I have never
really used ‘guix shell --root’ but it is probably what is needed.
All that to say that I am not totally happy with my workflow because I
do not know what interface I want. :-)
Cheers,
simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
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-26 18:58 ` pinoaffe
@ 2022-09-28 7:36 ` Efraim Flashner
2022-09-28 12:42 ` Efraim Flashner
2022-10-01 4:47 ` James Thomas
2022-10-01 8:22 ` Philip Kaludercic
4 siblings, 1 reply; 16+ messages in thread
From: Efraim Flashner @ 2022-09-28 7:36 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-28 7:36 ` Efraim Flashner
@ 2022-09-28 12:42 ` Efraim Flashner
0 siblings, 0 replies; 16+ messages in thread
From: Efraim Flashner @ 2022-09-28 12:42 UTC (permalink / raw)
To: Thompson, David, guix-devel
[-- Attachment #1: Type: text/plain, Size: 3096 bytes --]
On Wed, Sep 28, 2022 at 10:36:12AM +0300, Efraim Flashner wrote:
> 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.
It would seem I was so certain it would work I didn't check before
pasting and sending.
--
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 --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-27 11:13 ` Thompson, David
@ 2022-09-28 14:11 ` Maxim Cournoyer
0 siblings, 0 replies; 16+ messages in thread
From: Maxim Cournoyer @ 2022-09-28 14:11 UTC (permalink / raw)
To: Thompson, David
Cc: Olivier Dion via Development of GNU Guix and the GNU System distribution.,
Olivier Dion
Hi,
"Thompson, David" <dthompson2@worcester.edu> writes:
> On Mon, Sep 26, 2022 at 10:44 PM Maxim Cournoyer
> <maxim.cournoyer@gmail.com> wrote:
>>
>> Hi,
>>
>> Olivier Dion via "Development of GNU Guix and the GNU System
>> distribution." <guix-devel@gnu.org> writes:
>>
>> [...]
>>
>> > I have the following in my .dir-locals.el for my library libpatch. The
>> > idea is the same, but without direnv:
>> >
>> > ((nil
>> > . ((eval .
>> > (let ((root (locate-dominating-file
>> > default-directory ".dir-locals.el")))
>> > (when root
>> > (let ((real-root (directory-file-name (expand-file-name root))))
>> > (setq-local geiser-guile-binary (concat real-root "/.geiser-guile"))
>> > (setq-local projectile-project-compilation-cmd
>> > (concat real-root "/.projectile-compile"))
>> > (setq-local projectile-project-test-cmd
>> > (concat real-root "/.projectile-test")))))))))
>> >
>>
>> It seems to me it'd help everyone if Geiser should handle the above by
>> itself. It'd be cool to have the above functionality merged into Geiser
>> itelf. Just saying; thank you for sharing!
>
> With Emacs 28 and new versions of Geiser (such as the one in Guix) I
> highly recommend enabling per-project REPLs. By setting
> geiser-repl-per-project-p to 't', commands like M-x run-guile and C-c
> C-a will open/switch to a REPL associated with the current project as
> determined by project.el. This is useful for when you are working on
> multiple projects at once as it makes it harder to mix up REPLs, but
> Geiser also automatically inserts the project root directory into
> Guile's load path.
Thanks, that's very useful information! It seems like we could simplify
our Geiser auto-configuration snippet in Guix's .dir-locals.el by making
use of this new Geiser feature.
Maxim
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-26 17:48 Emacs integration for 'guix shell' Thompson, David
` (2 preceding siblings ...)
2022-09-28 7:36 ` Efraim Flashner
@ 2022-10-01 4:47 ` James Thomas
2022-10-01 8:22 ` Philip Kaludercic
4 siblings, 0 replies; 16+ messages in thread
From: James Thomas @ 2022-10-01 4:47 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
Thompson, David wrote:
> 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.
Great work!
You might also want to check out a package called buffer-env [1] for
this, which is more generally applicable. [2] is a blog post describing
one way to use it in Guix.
[1] https://github.com/astoff/buffer-env/
[2] https://amodernist.com/texts/emacs-guix.html
--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-09-26 17:48 Emacs integration for 'guix shell' Thompson, David
` (3 preceding siblings ...)
2022-10-01 4:47 ` James Thomas
@ 2022-10-01 8:22 ` Philip Kaludercic
2022-10-01 11:58 ` Thompson, David
4 siblings, 1 reply; 16+ messages in thread
From: Philip Kaludercic @ 2022-10-01 8:22 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
"Thompson, David" <dthompson2@worcester.edu> writes:
> 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!
I haven't used direnv, but how does it compare to buffer-env? I worked
on the Guix integration a few months ago and it has been working really
well for me.
> That's all for now,
>
> - Dave
>
> [0] https://dthompson.us/guix-for-development.html
> [1] https://git.dthompson.us/emacs-guix-shell.git/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-10-01 8:22 ` Philip Kaludercic
@ 2022-10-01 11:58 ` Thompson, David
2022-10-01 14:38 ` Philip Kaludercic
0 siblings, 1 reply; 16+ messages in thread
From: Thompson, David @ 2022-10-01 11:58 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: guix-devel
Hi Philip,
On Sat, Oct 1, 2022 at 4:22 AM Philip Kaludercic <philipk@posteo.net> wrote:
>
> "Thompson, David" <dthompson2@worcester.edu> writes:
>
> > 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!
>
> I haven't used direnv, but how does it compare to buffer-env? I worked
> on the Guix integration a few months ago and it has been working really
> well for me.
Oh, I didn't realize buffer-env had Guix integration. My little
project may be completely unnecessary, then. When I looked at it I
noticed that it still used .envrc files and wasn't fully compatible
with direnv so it didn't seem as good compared to something that just
directly invoked 'guix shell'. Will buffer-env automatically invoke
'guix shell' without the presence of a .envrc file? And does it
integrate with project.el? I guess I can answer these myself by
trying it out. If it does both of these things then I can happily
switch over to it.
Thanks for the pointer!
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Emacs integration for 'guix shell'
2022-10-01 11:58 ` Thompson, David
@ 2022-10-01 14:38 ` Philip Kaludercic
2022-12-06 14:59 ` [EXT] " Thompson, David
0 siblings, 1 reply; 16+ messages in thread
From: Philip Kaludercic @ 2022-10-01 14:38 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
"Thompson, David" <dthompson2@worcester.edu> writes:
> Hi Philip,
>
> On Sat, Oct 1, 2022 at 4:22 AM Philip Kaludercic <philipk@posteo.net> wrote:
>
>> I haven't used direnv, but how does it compare to buffer-env? I worked
>> on the Guix integration a few months ago and it has been working really
>> well for me.
>
> Oh, I didn't realize buffer-env had Guix integration. My little
> project may be completely unnecessary, then. When I looked at it I
> noticed that it still used .envrc files and wasn't fully compatible
> with direnv so it didn't seem as good compared to something that just
> directly invoked 'guix shell'. Will buffer-env automatically invoke
> 'guix shell' without the presence of a .envrc file?
Yes, you configure what file it should use to collect modified
environment variables (called `buffer-env-script-name'), and then
depending on the file name it will run a command. E.g. if you want to
use manifest.scm files and a manifest.scm file is found, it will run
guix shell -D -f \"path/to/mainfest.scm\" -- env -0
> And does it
> integrate with project.el?
No, instead it just looks for the guix.scm or manifest.scm file in a
"dominating directory" (the current working directory or anything
above). Project.el integration would be trivial to add though.
> I guess I can answer these myself by
> trying it out. If it does both of these things then I can happily
> switch over to it.
>
> Thanks for the pointer!
I wrote about it in some more detail here:
https://amodernist.com/texts/emacs-guix.html, but the post didn't
attract much attention.
> - Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [EXT] Re: Emacs integration for 'guix shell'
2022-10-01 14:38 ` Philip Kaludercic
@ 2022-12-06 14:59 ` Thompson, David
0 siblings, 0 replies; 16+ messages in thread
From: Thompson, David @ 2022-12-06 14:59 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: guix-devel
Hey Philip,
Just a little update for this old thread. Around the time of your
email the Emacs package was modified to enable native compilation.
Unfortunately, it made Emacs unusable on my computer which stopped my
Emacs experimentation for a bit. I'm past that now, thankfully.
On Sat, Oct 1, 2022 at 10:38 AM Philip Kaludercic <philipk@posteo.net> wrote:
>
> I wrote about it in some more detail here:
> https://amodernist.com/texts/emacs-guix.html, but the post didn't
> attract much attention.
Thanks for writing that blog post! It was very helpful. I now have
buffer-env handling 'guix shell' integration and it works like a
charm.
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-12-06 15:01 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.