unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Some emacs stuff to activate/deactivate guix profiles
@ 2020-12-16 19:43 pinoaffe
  0 siblings, 0 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-16 19:43 UTC (permalink / raw)
  To: guix-devel

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

Hi guix!
    
I wrote some elisp that
* maintains a list of available guix profiles
* maintains a list of active guix profiles
* allows the user to modify both of those lists
* provides interactive commands that allow the user to (de)activate profiles
* sets env variables and the emacs search path based on active profiles
I may add the ability to "update" a profile from a manifest.

This allows me to have a profile with, say, reverse engineering tools,
and to (de)activate it whenever I do(nt) need those tools.

Please not that I'm fairly new to all of this emacs stuff, so it may not
be idiomatic or good code.

I've attached the reusable stuff in guix-profiles.el, and my personal
config in init-profiles.el.

Any thoughts?

Blessings,
pinoaffe


[-- Attachment #2: guix-profiles.el --]
[-- Type: application/emacs-lisp, Size: 4061 bytes --]

[-- Attachment #3: init-profiles.el --]
[-- Type: application/emacs-lisp, Size: 1550 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Some emacs stuff to activate/deactivate guix profiles
@ 2020-12-16 19:43 pinoaffe
  0 siblings, 0 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-16 19:43 UTC (permalink / raw)
  To: guix-devel

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

Hi guix!
    
I wrote some elisp that
* maintains a list of available guix profiles
* maintains a list of active guix profiles
* allows the user to modify both of those lists
* provides interactive commands that allow the user to (de)activate profiles
* sets env variables and the emacs search path based on active profiles
I may add the ability to "update" a profile from a manifest.

This allows me to have a profile with, say, reverse engineering tools,
and to (de)activate it whenever I do(nt) need those tools.

Please not that I'm fairly new to all of this emacs stuff, so it may not
be idiomatic or good code.

I've attached the reusable stuff in guix-profiles.el, and my personal
config in init-profiles.el.

Any thoughts?

Blessings,
pinoaffe


[-- Attachment #2: guix-profiles.el --]
[-- Type: application/emacs-lisp, Size: 4061 bytes --]

[-- Attachment #3: init-profiles.el --]
[-- Type: application/emacs-lisp, Size: 1550 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Some emacs stuff to activate/deactivate guix profiles
@ 2020-12-17  4:57 pinoaffe
  0 siblings, 0 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-17  4:57 UTC (permalink / raw)
  To: guix-devel

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

Hi guix!
    
I wrote some elisp that
* maintains a list of available guix profiles
* maintains a list of active guix profiles
* allows the user to modify both of those lists
* provides interactive commands that allow the user to (de)activate profiles
* sets env variables and the emacs search path based on active profiles
I may add the ability to "update" a profile from a manifest.

This allows me to have a profile with, say, reverse engineering tools,
and to (de)activate it whenever I do(nt) need those tools.

Please not that I'm fairly new to all of this emacs stuff, so it may not
be idiomatic or good code.

I've attached the reusable stuff in guix-profiles.el, and my personal
config in init-profiles.el.

Any thoughts?

Blessings,
pinoaffe


[-- Attachment #2: guix-profiles.el --]
[-- Type: application/emacs-lisp, Size: 4061 bytes --]

[-- Attachment #3: init-profiles.el --]
[-- Type: application/emacs-lisp, Size: 1550 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Some emacs stuff to activate/deactivate guix profiles
@ 2020-12-17  4:59 pinoaffe
  2020-12-17  8:26 ` zimoun
  2020-12-17  8:31 ` pinoaffe
  0 siblings, 2 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-17  4:59 UTC (permalink / raw)
  To: guix-devel

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

Hi guix!
    
I wrote some elisp that
* maintains a list of available guix profiles
* maintains a list of active guix profiles
* allows the user to modify both of those lists
* provides interactive commands that allow the user to (de)activate profiles
* sets env variables and the emacs search path based on active profiles
I may add the ability to "update" a profile from a manifest.

This allows me to have a profile with, say, reverse engineering tools,
and to (de)activate it whenever I do(nt) need those tools.

Please not that I'm fairly new to all of this emacs stuff, so it may not
be idiomatic or good code.

I've attached the reusable stuff in guix-profiles.el, and my personal
config in init-profiles.el.

Any thoughts?

Blessings,
pinoaffe


[-- Attachment #2: guix-profiles.el --]
[-- Type: application/emacs-lisp, Size: 4061 bytes --]

[-- Attachment #3: init-profiles.el --]
[-- Type: application/emacs-lisp, Size: 1550 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  4:59 pinoaffe
@ 2020-12-17  8:26 ` zimoun
  2020-12-17  8:36   ` pinoaffe
  2020-12-17  8:31 ` pinoaffe
  1 sibling, 1 reply; 11+ messages in thread
From: zimoun @ 2020-12-17  8:26 UTC (permalink / raw)
  To: pinoaffe, guix-devel

Hi,

On Thu, 17 Dec 2020 at 05:59, pinoaffe <pinoaffe@gmail.com> wrote:

> I've attached the reusable stuff in guix-profiles.el, and my personal
> config in init-profiles.el.

Thanks for sharing.

> (defun guix-profiles->environment-vars (profiles)
>   (shell-command-to-string
>    (string-join (apply #'list
>                        "guix"
>                        "package"
>                        "--search-paths"

Instead of call shell command and then…

> (defun guix-path-file->key-value (str)
>   (mapcar (lambda (line)
>               (let* ((lst (split-string line "="))
>                      (var (string-remove-prefix "export " (car lst)))
>                      (val (string-trim (string-join (cdr lst) "=") "\"" "\"")))
>                 (cons var val)))
>           (split-string (string-trim-right str "\n")
>                         "\n")))

…parse the output, you should give a look at how Emacs-Guix does using
the Scheme API.  Or maybe use “guix repl” as Nyxt does.


Aside, it is a bit redundant with Emacs-Guix, from my understanding. :-)

All the best,
simon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Some emacs stuff to activate/deactivate guix profiles
@ 2020-12-17  8:29 pinoaffe
  2020-12-17  9:32 ` Jan Nieuwenhuizen
  0 siblings, 1 reply; 11+ messages in thread
From: pinoaffe @ 2020-12-17  8:29 UTC (permalink / raw)
  To: guix-devel

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

Hi guix!
    
I wrote some elisp that
* maintains a list of available guix profiles
* maintains a list of active guix profiles
* allows the user to modify both of those lists
* provides interactive commands that allow the user to (de)activate profiles
* sets env variables and the emacs search path based on active profiles
I may add the ability to "update" a profile from a manifest.

This allows me to have a profile with, say, reverse engineering tools,
and to (de)activate it whenever I do(nt) need those tools.

Please not that I'm fairly new to all of this emacs stuff, so it may not
be idiomatic or good code.

I've attached the reusable stuff in guix-profiles.el, and my personal
config in init-profiles.el.

Any thoughts?

Blessings,
pinoaffe


[-- Attachment #2: guix-profiles.el --]
[-- Type: application/emacs-lisp, Size: 4061 bytes --]

[-- Attachment #3: init-profiles.el --]
[-- Type: application/emacs-lisp, Size: 1550 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  4:59 pinoaffe
  2020-12-17  8:26 ` zimoun
@ 2020-12-17  8:31 ` pinoaffe
  1 sibling, 0 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-17  8:31 UTC (permalink / raw)
  To: guix-devel

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

Hi everybody, sorry for the repeated messages, something went wrong with
mu4e

On Thu, Dec 17, 2020 at 4:59 AM pinoaffe <pinoaffe@gmail.com> wrote:

> Hi guix!
>
> I wrote some elisp that
> * maintains a list of available guix profiles
> * maintains a list of active guix profiles
> * allows the user to modify both of those lists
> * provides interactive commands that allow the user to (de)activate
> profiles
> * sets env variables and the emacs search path based on active profiles
> I may add the ability to "update" a profile from a manifest.
>
> This allows me to have a profile with, say, reverse engineering tools,
> and to (de)activate it whenever I do(nt) need those tools.
>
> Please not that I'm fairly new to all of this emacs stuff, so it may not
> be idiomatic or good code.
>
> I've attached the reusable stuff in guix-profiles.el, and my personal
> config in init-profiles.el.
>
> Any thoughts?
>
> Blessings,
> pinoaffe
>
>

[-- Attachment #2: Type: text/html, Size: 1318 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  8:26 ` zimoun
@ 2020-12-17  8:36   ` pinoaffe
  2020-12-17  8:52     ` zimoun
  0 siblings, 1 reply; 11+ messages in thread
From: pinoaffe @ 2020-12-17  8:36 UTC (permalink / raw)
  To: zimoun; +Cc: guix-devel


zimoun writes:
>
> Instead of call shell command and then…
>
> …parse the output, you should give a look at how Emacs-Guix does using
> the Scheme API.  Or maybe use “guix repl” as Nyxt does.
Thanks for the suggestion, I'll look into that

> Aside, it is a bit redundant with Emacs-Guix, from my
> understanding. :-)
It might very well be, but I couldn't find a way to do what I wanted to
do with emacs-guix

Blessing,
pinoaffe


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  8:36   ` pinoaffe
@ 2020-12-17  8:52     ` zimoun
  0 siblings, 0 replies; 11+ messages in thread
From: zimoun @ 2020-12-17  8:52 UTC (permalink / raw)
  To: pinoaffe; +Cc: guix-devel

Hi,

On Thu, 17 Dec 2020 at 09:36, pinoaffe <pinoaffe@gmail.com> wrote:

>> Aside, it is a bit redundant with Emacs-Guix, from my
>> understanding. :-)
> It might very well be, but I couldn't find a way to do what I wanted to
> do with emacs-guix

I guess the entrypoint is ’guix-set-emacs-environment’.  But I have not
looked into the details of your code, neither checked if the Emacs-Guix
is currently working as expected.

<https://github.com/jsoo1/guix.el/blob/master/elisp/guix-misc.el#L225>

I understand though that the learning process is often easier by doing
by their own instead of adding or fixing the wanted feature with an
existing code base. :-)

All the best,
simon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  8:29 pinoaffe
@ 2020-12-17  9:32 ` Jan Nieuwenhuizen
  2020-12-17 14:28   ` pinoaffe
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Nieuwenhuizen @ 2020-12-17  9:32 UTC (permalink / raw)
  To: pinoaffe; +Cc: guix-devel

pinoaffe writes:

Hello,

> I've attached the reusable stuff in guix-profiles.el, and my personal
> config in init-profiles.el.

> Any thoughts?

My emacs-guix already has a file called guix-profiles.el; how do you
handle that or how do I best look at / try your profiles?

This looks interesting; I'm using M-x guix-set-emacs-environment a
lot but my biggest problem/gripe with that is that it's global.

Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Some emacs stuff to activate/deactivate guix profiles
  2020-12-17  9:32 ` Jan Nieuwenhuizen
@ 2020-12-17 14:28   ` pinoaffe
  0 siblings, 0 replies; 11+ messages in thread
From: pinoaffe @ 2020-12-17 14:28 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel


Jan Nieuwenhuizen writes:
> My emacs-guix already has a file called guix-profiles.el; how do you
> handle that
oops, I think I'll rename this script then :)
    
> or how do I best look at / try your profiles?
I think the easiest way to try this is to source the guix-profiles file,
set the three "defcustom" variables, and to then run guix-enable-profile
or guix-disable-profile interactively.

> This looks interesting; I'm using M-x guix-set-emacs-environment a
> lot but my biggest problem/gripe with that is that it's global.
Yeah this is also global, as far as I can tell the only difference with
guix-set-emacs-environment seems to be that this allows enabling several
profiles at the same time and that this script maintains a list of which
profiles should be active. I think I'll take a look at how this could be
integrated into emacs-guix.
    
As to non-global things: I think a way to open a shell in emacs with a
specific set of packages available would be nice, but I'm not sure
whether it'd be better to wrap `guix environment` or to implement
something that starts a subprocess with the environment variables
corresponding to a (set of) profile(s). When implemented correctly, this
could also be applied through per-project profiles when combined with a
project manager such as projectile.
    
Blessings,
pinoaffe


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-17 14:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 19:43 Some emacs stuff to activate/deactivate guix profiles pinoaffe
  -- strict thread matches above, loose matches on Subject: below --
2020-12-17  8:29 pinoaffe
2020-12-17  9:32 ` Jan Nieuwenhuizen
2020-12-17 14:28   ` pinoaffe
2020-12-17  4:59 pinoaffe
2020-12-17  8:26 ` zimoun
2020-12-17  8:36   ` pinoaffe
2020-12-17  8:52     ` zimoun
2020-12-17  8:31 ` pinoaffe
2020-12-17  4:57 pinoaffe
2020-12-16 19:43 pinoaffe

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).