unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Creating environments using Guix package manager
Date: Sun, 7 Jun 2020 16:41:57 +0200	[thread overview]
Message-ID: <CAJ3okZ03AF4BYGgFCDYfyUk4yRFpkR6O-xjESmC9qMpptq1YQw@mail.gmail.com> (raw)
In-Reply-To: <76a84e1c-798b-eaf0-725f-a6fea5bd76bf@posteo.de>

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


  reply	other threads:[~2020-06-07 14:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=CAJ3okZ03AF4BYGgFCDYfyUk4yRFpkR6O-xjESmC9qMpptq1YQw@mail.gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=zelphirkaltstahl@posteo.de \
    /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.
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).