unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Pierre-Antoine Bouttier
	<Pierre-Antoine.Bouttier@univ-grenoble-alpes.fr>,
	help-guix <help-guix@gnu.org>
Subject: Re: nix shellHook equivalent for guix environment?
Date: Wed, 10 Mar 2021 15:07:19 +0100	[thread overview]
Message-ID: <86k0qfcdbc.fsf@gmail.com> (raw)
In-Reply-To: <7663A078-15A7-41AC-BBAB-AED626151B15@univ-grenoble-alpes.fr>

Hi Pierre-Antoine,

On Tue, 09 Mar 2021 at 17:23, Pierre-Antoine Bouttier <Pierre-Antoine.Bouttier@univ-grenoble-alpes.fr> wrote:

> Do you know if there is any equivalent to shellHook, available for the
> nix-shell command, for setting up a guix environment through a
> manifest.scm file? 
>
> Or maybe another methodology with guix to have approximatively the
> same behavior? (i.e. in a file that can be put under version control,
> defining dependancies and also init commands to set up a guix
> environment) 

I do not know what shellHook and nix-shell are, well I do not know what
they exactly do so it is hard to answer if an equivalent is there or
not. :-)

Well, I think some UI and interface is missing here, especially to have
a manifest containing the inputs of a package.  Currently, this ugly:

--8<---------------cut here---------------start------------->8---
$ guix environment hello --ad-hoc python -r /tmp/example

$ guix package --export-manifest -p /tmp/example
;; This "manifest" file can be passed to 'guix package -m' to reproduce
;; the content of your profile.  This is "symbolic": it only specifies
;; package names.  To reproduce the exact same profile, you also need to
;; capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(specifications->manifest
  (list "htop"
        "tar"
        "gzip"
        "bzip2"
        "xz"
        "file"
        "diffutils"
        "patch"
        "findutils"
        "gawk"
        "sed"
        "grep"
        "coreutils"
        "make"
        "bash-minimal"
        "ld-wrapper"
        "binutils"
        "gcc"
        "glibc"
        "glibc:static"
        "glibc-utf8-locales"
        "linux-libre-headers@5.4.20"))
--8<---------------cut here---------------end--------------->8---

And what you would like is something like to create a manifest.scm file
containing all the inputs of the package hello:

--8<---------------cut here---------------start------------->8---
(use-modules (guix)
             (guix profiles)
             (guix scripts environment)
             (gnu packages base))

(make-manifest (package-environment-inputs hello))
--8<---------------cut here---------------end--------------->8---

but ’package-environment-inputs’ is not publicly exposed.  Well, there
is probably other things in the public API doing something similar as
package-environment-inputs.


Once you have a profile, you can use it with “guix environment” and for
example launch it in a container:

--8<---------------cut here---------------start------------->8---
$ guix environment -C --profile=/tmp/example
--8<---------------cut here---------------end--------------->8---

However, there is no clean API to do it at the manifest.scm level.  Ludo
proposed something long time ago but some love for this feature is
missing. :-) And the feature requests popups time to time. :-)

<https://lists.gnu.org/archive/html/help-guix/2018-01/msg00118.html>
<https://lists.gnu.org/archive/html/guix-devel/2020-07/msg00005.html>


Hope that helps,
simon


  reply	other threads:[~2021-03-10 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 16:23 nix shellHook equivalent for guix environment? Pierre-Antoine Bouttier
2021-03-10 14:07 ` zimoun [this message]
2021-03-11  6:57   ` Pierre-Antoine Bouttier
2021-03-10 15:03 ` Xinglu Chen
2021-03-11  6:58   ` Pierre-Antoine Bouttier

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=86k0qfcdbc.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=Pierre-Antoine.Bouttier@univ-grenoble-alpes.fr \
    --cc=help-guix@gnu.org \
    /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).