all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Creating environments using Guix package manager
@ 2020-06-07 12:28 Zelphir Kaltstahl
  2020-06-07 12:37 ` Julien Lepiller
  2020-06-07 13:48 ` zimoun
  0 siblings, 2 replies; 9+ messages in thread
From: Zelphir Kaltstahl @ 2020-06-07 12:28 UTC (permalink / raw)
  To: help-guix

Hi Guix Users!

For some time now I would like to create Guix environments for separate
projects.

I've tried finding the way to do it at
https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html
but have been unable to read out of it, how to do it.

I would like environments that have the following:

+ persistent (something with the --root argument?)
+ activate-able / deactivate-able (something like Python's environments:
source env_name/bin/activate)
+ their own dependencies, not mixed with anything in my base guix profile
+ Not only temporary
+ one time install (do not want to reinstall all packages every time I
want to use the environment)
+ simply use the environment to run programs in the environment

Today I had a conflict of versions of packages, which brought up this
issue again for me:

~~~~
building /gnu/store/yniz1rh5cih92i72flj1x2cmlwv1nngk-keepassxc-2.5.4.drv...
guix package: error: profile contains conflicting entries for gmp
guix package: error:   first entry: gmp@6.2.0 /gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0
guix package: error:    ... propagated from guile@3.0.2
guix package: error:   second entry: gmp@6.1.2 /gnu/store/y7qk8raalgvdnxcglvxa320cfxrjk1x6-gmp-6.1.2
guix package: error:    ... propagated from nettle@3.5.1
guix package: error:    ... propagated from gnutls@3.6.A
hint: Try upgrading both `guile' and `gnutls', or remove one of them from the profile.
~~~~

So I cannot complete `guix package -u`. I guess some of those packages
in my base profile are not even needed for most things I do and would be
better contained in project-specific environments, so that they do not
cause conflicts.

Is it possible to create such kind of environments using Guix? I feel
like it should probably be an easy thing to do, once I know how to do
it, but I could not find a tutorial, which tells me how to do this.
Perhaps my idea about how Guix is used usually is wrong?

Regards,
Zelphir


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

* Re: Creating environments using Guix package manager
  2020-06-07 12:28 Creating environments using Guix package manager Zelphir Kaltstahl
@ 2020-06-07 12:37 ` Julien Lepiller
  2020-06-07 13:27   ` Zelphir Kaltstahl
  2020-06-07 14:11   ` Zelphir Kaltstahl
  2020-06-07 13:48 ` zimoun
  1 sibling, 2 replies; 9+ messages in thread
From: Julien Lepiller @ 2020-06-07 12:37 UTC (permalink / raw)
  To: help-guix, Zelphir Kaltstahl

Le 7 juin 2020 08:28:16 GMT-04:00, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> a écrit :
>Hi Guix Users!
>
>For some time now I would like to create Guix environments for separate
>projects.
>
>I've tried finding the way to do it at
>https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html
>but have been unable to read out of it, how to do it.
>
Have you read http://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practice.html#Guix-Profiles-in-Practice yet? I think it's relevant to what you want to do (a persistant env is a profile).


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

* Re: Creating environments using Guix package manager
  2020-06-07 12:37 ` Julien Lepiller
@ 2020-06-07 13:27   ` Zelphir Kaltstahl
  2020-06-07 14:41     ` zimoun
  2020-06-07 14:11   ` Zelphir Kaltstahl
  1 sibling, 1 reply; 9+ messages in thread
From: Zelphir Kaltstahl @ 2020-06-07 13:27 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix

Hi Julien!

Yes, I did see this before, but it is not a self-contained tutorial. For
example:

*
https://guix.gnu.org/cookbook/en/html_node/Basic-setup-with-manifests.html
states how a manifest file should look like. Looks like Scheme code,
that's fine. But no `use-modules` or anything? Is this correct? And then
what is the file name? I named it `manifest.scm`. Is this correct?

* Quote: "We can create a manifest specification per profile and install
them this way: […]" – A few questions come up immediately:

1. Is this literally, what I type into a terminal emulator?

2. Or does this go into my `.profile`?

3. Does `.guix-extra-profiles` already need to exist?

4. Did I do something wrong with my Guix installation, if it does not
exist yet?

5. Do I need to input those 4 lines every time to create an environment?

All these things need clarification and make me unsure about whether I
am doing anything correctly.

Silly me forgot to mention, that I installed Guix package manager on a
foreign distro (Trisquel 8), not using it in a Guix distro.

I'll try to go with best guesses and see how it goes. Thanks so far!

Regards,
Zelphir

On 07.06.20 14:37, Julien Lepiller wrote:
> Le 7 juin 2020 08:28:16 GMT-04:00, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> a écrit :
>> Hi Guix Users!
>>
>> For some time now I would like to create Guix environments for separate
>> projects.
>>
>> I've tried finding the way to do it at
>> https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html
>> but have been unable to read out of it, how to do it.
>>
> Have you read http://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practice.html#Guix-Profiles-in-Practice yet? I think it's relevant to what you want to do (a persistant env is a profile).


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

* Re: Creating environments using Guix package manager
  2020-06-07 12:28 Creating environments using Guix package manager Zelphir Kaltstahl
  2020-06-07 12:37 ` Julien Lepiller
@ 2020-06-07 13:48 ` zimoun
  2020-06-07 14:22   ` Creating environments using Guix package manager and collision Zelphir Kaltstahl
  1 sibling, 1 reply; 9+ messages in thread
From: zimoun @ 2020-06-07 13:48 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

Dear,

On Sun, 7 Jun 2020 at 14:28, Zelphir Kaltstahl
<zelphirkaltstahl@posteo.de> wrote:

> ~~~~
> building /gnu/store/yniz1rh5cih92i72flj1x2cmlwv1nngk-keepassxc-2.5.4.drv...
> guix package: error: profile contains conflicting entries for gmp
> guix package: error:   first entry: gmp@6.2.0 /gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0
> guix package: error:    ... propagated from guile@3.0.2
> guix package: error:   second entry: gmp@6.1.2 /gnu/store/y7qk8raalgvdnxcglvxa320cfxrjk1x6-gmp-6.1.2
> guix package: error:    ... propagated from nettle@3.5.1
> guix package: error:    ... propagated from gnutls@3.6.A
> hint: Try upgrading both `guile' and `gnutls', or remove one of them from the profile.
> ~~~~
>
> So I cannot complete `guix package -u`. I guess some of those packages
> in my base profile are not even needed for most things I do and would be
> better contained in project-specific environments, so that they do not
> cause conflicts.

Does the option '--allow-collisions' of "guix package" fit your needs?


> Is it possible to create such kind of environments using Guix? I feel
> like it should probably be an easy thing to do, once I know how to do
> it, but I could not find a tutorial, which tells me how to do this.
> Perhaps my idea about how Guix is used usually is wrong?

I will reply to your other message. :-)


All the best,
simon


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

* Re: Creating environments using Guix package manager
  2020-06-07 12:37 ` Julien Lepiller
  2020-06-07 13:27   ` Zelphir Kaltstahl
@ 2020-06-07 14:11   ` Zelphir Kaltstahl
  2020-06-07 14:44     ` zimoun
  1 sibling, 1 reply; 9+ messages in thread
From: Zelphir Kaltstahl @ 2020-06-07 14:11 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix

I've gotten a lot further this time and got my first separate profile
created and activated : )

I wrote the steps down here:

https://notabug.org/ZelphirKaltstahl/guix-package-manager-tutorials/src/master/howto.org

Currently missing how to deactivate a profile. Of course one could close
the terminal emulator, but perhaps I just need to read a little further
and it will reveal itself to me, how to do it.

Thanks for helping!

On 07.06.20 14:37, Julien Lepiller wrote:
> Le 7 juin 2020 08:28:16 GMT-04:00, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> a écrit :
>> Hi Guix Users!
>>
>> For some time now I would like to create Guix environments for separate
>> projects.
>>
>> I've tried finding the way to do it at
>> https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html
>> but have been unable to read out of it, how to do it.
>>
> Have you read http://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practice.html#Guix-Profiles-in-Practice yet? I think it's relevant to what you want to do (a persistant env is a profile).


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

* Re: Creating environments using Guix package manager and collision
  2020-06-07 13:48 ` zimoun
@ 2020-06-07 14:22   ` Zelphir Kaltstahl
  2020-06-07 14:55     ` zimoun
  0 siblings, 1 reply; 9+ messages in thread
From: Zelphir Kaltstahl @ 2020-06-07 14:22 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

I'll have to read up on the `--allow-collisions` flag and see, whether
it does anything dangerous. It sounds dangerous.

I also just noticed, that the conflict seems to have messed up my Guile.
Cannot run Guile any longer, as there is now an issue with readline,
although it is installed:

~~~~
[14:54:09]:[~/development/Guile/risk-calculator]: guile
;;; WARNING: loading compiled file
/home/user/.guix-profile/lib/guile/2.2/site-ccache/ice-9/readline.go
failed:
;;; In procedure load-thunk-from-memory: incompatible bytecode kind
;;; WARNING: loading compiled file
/home/user/.guix-profile/lib/guile/2.2/site-ccache/ice-9/readline.go
failed:
;;; In procedure load-thunk-from-memory: incompatible bytecode kind
Backtrace:
In ice-9/boot-9.scm:
    702:2 19 (call-with-prompt ("prompt") #<procedure 1c57a60 at ic…> …)
In ice-9/eval.scm:
    619:8 18 (_ #(#(#<directory (guile-user) 1aaf750>)))
In unknown file:
          17 (primitive-load "/home/user/.guile")
In ice-9/eval.scm:
   721:20 16 (primitive-eval (use-modules (ice-9 readline) (# #) # #))
In ice-9/psyntax.scm:
  1241:36 15 (expand-top-sequence ((use-modules (ice-9 readline) …)) …)
  1233:19 14 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)
   285:10 13 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) …)
In ice-9/boot-9.scm:
  3373:20 12 (process-use-modules _)
   222:17 11 (map1 (((ice-9 readline)) ((ice-9 format)) ((ice-9 …)) …))
  3374:31 10 (_ ((ice-9 readline)))
  2790:17  9 (resolve-interface (ice-9 readline) #:select _ #:hide _ …)
In ice-9/threads.scm:
    390:8  8 (_ _)
In ice-9/boot-9.scm:
  2716:13  7 (_)
In ice-9/threads.scm:
    390:8  6 (_ _)
In ice-9/boot-9.scm:
  2985:20  5 (_)
   2299:4  4 (save-module-excursion #<procedure 1ac05d0 at ice-9/boo…>)
  3005:26  3 (_)
In unknown file:
           2 (primitive-load-path "ice-9/readline" #<procedure 1c570…>)
In /home/user/.guix-profile/share/guile/site/2.2/ice-9/readline.scm:
     44:4  1 (_)
In unknown file:
           0 (load-extension "/gnu/store/2fsg1jl3hwxnak9h39f6vzx87h…" …)

ERROR: In procedure load-extension:
In procedure dynamic-link: file:
"/gnu/store/2fsg1jl3hwxnak9h39f6vzx87hp48dsm-guile-readline-2.2.4/lib/guile/3.0/extensions/guile-readline",
message: "file not found"
~~~~

So I commented out the `(use-modules (ice-9 readline))` and the
`(activate-readline)` from my `~/.guile` file and then it works again.
Perhaps because Guile was updated there is no suitable version of
guile-readline any longer. Guile is now at: 2.9.4.

(That is also something strange, that on one machine I get
`guile-next@2.9.4` and on the other I cannot get a `guile-next` (no
`guix search` result) but can get `guile@3.0.2`. And no matter how often
I run guix pull && guix package -u, it does not appear on the machine
with the older Guile version showing up.)

Thanks for the hint!

On 07.06.20 15:48, zimoun wrote:
> Dear,
>
> On Sun, 7 Jun 2020 at 14:28, Zelphir Kaltstahl
> <zelphirkaltstahl@posteo.de> wrote:
>
>> ~~~~
>> building /gnu/store/yniz1rh5cih92i72flj1x2cmlwv1nngk-keepassxc-2.5.4.drv...
>> guix package: error: profile contains conflicting entries for gmp
>> guix package: error:   first entry: gmp@6.2.0 /gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0
>> guix package: error:    ... propagated from guile@3.0.2
>> guix package: error:   second entry: gmp@6.1.2 /gnu/store/y7qk8raalgvdnxcglvxa320cfxrjk1x6-gmp-6.1.2
>> guix package: error:    ... propagated from nettle@3.5.1
>> guix package: error:    ... propagated from gnutls@3.6.A
>> hint: Try upgrading both `guile' and `gnutls', or remove one of them from the profile.
>> ~~~~
>>
>> So I cannot complete `guix package -u`. I guess some of those packages
>> in my base profile are not even needed for most things I do and would be
>> better contained in project-specific environments, so that they do not
>> cause conflicts.
> Does the option '--allow-collisions' of "guix package" fit your needs?
>
>
>> Is it possible to create such kind of environments using Guix? I feel
>> like it should probably be an easy thing to do, once I know how to do
>> it, but I could not find a tutorial, which tells me how to do this.
>> Perhaps my idea about how Guix is used usually is wrong?
> I will reply to your other message. :-)
>
>
> All the best,
> simon

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

* Re: Creating environments using Guix package manager
  2020-06-07 13:27   ` Zelphir Kaltstahl
@ 2020-06-07 14:41     ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2020-06-07 14:41 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

Dear Zelphir,

Well "guix environment" is a piece so the answer depends on which part
do you currently use?  If you use the "--container" option, then
profiles cannot be a drop-in replacement of your current workflow.  Or
I miss something.

However, from your specifications, the combination of manifest files
and profiles seems the correct approach for you.  For example -- I am
running Guix on the top of Debian -- I create the folder
'~/.config/guix/manifests' which contains the manifest file named
'default.scm':

--8<---------------cut here---------------start------------->8---
(specifications->manifest
 '("glibc-locales"
   "nss-certs"
   "recutils"))
--8<---------------cut here---------------end--------------->8---

then I run "guix package -m ~/.config/guix/manifests/default.scm".
Well, in this folder I have another manifest file named 'emacs.scm'
which contains:

--8<---------------cut here---------------start------------->8---
(specifications->manifest
 '("aspell"
   "aspell-dict-en"
   "notmuch"
   "emacs"
   "emacs-magit"))
--8<---------------cut here---------------end--------------->8---

then I run "guix package -m ~/.config/guix/manifests/emacs.scm -p
~/.config/guix/profiles/emacs".  And in my ~/.barsh_profile, I have
something looping over these profiles as explained in the blog post.

These are my personal setup profiles -- the list of packages is cutted. :-)

Then, I have profiles per project which live inside the project
folder.  For example, I have the folder '~/src/project-foo' which
contains a manifest file used to generated the profile, i.e.,

   guix package -m ~/src/project-foo/manifest.scm -p
~/src/project-foo/profile/profile

well, I double profile/profile to avoid to pollute the project folder
by links; anyway.  When I am working on this project, I use "eval
$(guix package --search-paths=exact -p
~/src/project-foo/profile/profile)" to set up; 'exact' is sometimes
replaced by 'prefix' in my case, well it depends.

I do not know if it is what you need.  Neither if it is the correct
way to organize.


Last, it is not easy to have the equivalent of "guix environment
hello" using manifest.  To do so, you need some undocumented magic.
:-)

--8<---------------cut here---------------start------------->8---
;; From HERE
(use-modules (ice-9 match)
             (srfi srfi-1)
             (guix packages)
             (guix profiles))

(define (input->manifest-entry input)
  "Return a manifest entry for INPUT, or #f if INPUT does not correspond to a
package."
  (match input
    ((_ (? package? package))
     (package->manifest-entry package))
    ((_ (? package? package) output)
     (package->manifest-entry package output))
    (_
     #f)))

(define (inputs-of package)
  (filter-map input->manifest-entry
              (bag-transitive-inputs (package->bag package))))
;; To THERE should be replaced by only
;;
;; THAT
;; (define inputs-of (@@ (guix scripts environment)
;;                      package-environment-inputs))

(make-manifest
 (inputs-of
  (specification->package "hello")))
--8<---------------cut here---------------end--------------->8---

then let run

   guix package -m manif.scm -p /tmp/hello
   eval $(guix package --search-paths=exact -p /tmp/hello)

which is equivalent to "guix environment --pure hello" but in a permanent way.


Hope that helps.

All the best,
simon

ps:
I do not understand why the '@@' does not work so it is an ugly copy/paste. :-)


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

* Re: Creating environments using Guix package manager
  2020-06-07 14:11   ` Zelphir Kaltstahl
@ 2020-06-07 14:44     ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2020-06-07 14:44 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

On Sun, 7 Jun 2020 at 16:11, Zelphir Kaltstahl
<zelphirkaltstahl@posteo.de> wrote:

> Currently missing how to deactivate a profile. Of course one could close
> the terminal emulator, but perhaps I just need to read a little further
> and it will reveal itself to me, how to do it.

Currently, it is not possible.  See [1] for the discussion on how to
implement the feature.

[1] https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00477.html


All the best,
simon


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

* Re: Creating environments using Guix package manager and collision
  2020-06-07 14:22   ` Creating environments using Guix package manager and collision Zelphir Kaltstahl
@ 2020-06-07 14:55     ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2020-06-07 14:55 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

On Sun, 7 Jun 2020 at 16:22, Zelphir Kaltstahl
<zelphirkaltstahl@posteo.de> wrote:

> So I commented out the `(use-modules (ice-9 readline))` and the `(activate-readline)` from my `~/.guile` file and then it works again. Perhaps because Guile was updated there is no suitable version of guile-readline any longer. Guile is now at: 2.9.4.
>
> (That is also something strange, that on one machine I get `guile-next@2.9.4` and on the other I cannot get a `guile-next` (no `guix search` result) but can get `guile@3.0.2`. And no matter how often I run guix pull && guix package -u, it does not appear on the machine with the older Guile version showing up.)

Ah! It seems that the issue is incompatible version of Guile.  The big
2.x -> 3.0 update. :-)
I recommend you to upgrade everything to 3.0.  But I know few about
Guile so I am not sure that my advice is relevant.


All the best,
simon


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

end of thread, other threads:[~2020-06-07 14:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-07 12:28 Creating environments using Guix package manager Zelphir Kaltstahl
2020-06-07 12:37 ` Julien Lepiller
2020-06-07 13:27   ` Zelphir Kaltstahl
2020-06-07 14:41     ` zimoun
2020-06-07 14:11   ` Zelphir Kaltstahl
2020-06-07 14:44     ` zimoun
2020-06-07 13:48 ` zimoun
2020-06-07 14:22   ` Creating environments using Guix package manager and collision Zelphir Kaltstahl
2020-06-07 14:55     ` zimoun

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.