[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating environments using Guix package manager

From: zimoun
Subject: Re: Creating environments using Guix package manager
Date: Sun, 7 Jun 2020 16:41:57 +0200

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

--8<---------------cut here---------------start------------->8---
--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---
--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

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
  (match input
    ((_ (? package? package))
     (package->manifest-entry package))
    ((_ (? package? package) output)
     (package->manifest-entry package output))

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

  (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,

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]