unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Pierre-Antoine Bouttier <Pierre-Antoine.Bouttier@univ-grenoble-alpes.fr>
To: zimoun <zimon.toutoune@gmail.com>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: nix shellHook equivalent for guix environment?
Date: Thu, 11 Mar 2021 07:57:42 +0100	[thread overview]
Message-ID: <E92751B5-F3ED-47A0-B7D2-40F9D3F5C5B9@univ-grenoble-alpes.fr> (raw)
In-Reply-To: <86k0qfcdbc.fsf@gmail.com>

Hi Simon,

Thank you for your answer. Some interface helpers to build a proper manifest.scm would be appreciated, but this not really my problem here. 

Just FYI, nix-shell command is the equivalent of guix environment, and shellHook is the keyword of a particular section in the nix equivalent of manifest.scm.  

In fact, what I want to do is: based on a file (like manifest.scm), I want to describe : 
- describe inputs of my guix-environment
- define a bunch of commands that will be launched in the new shell created by the guix environment command (e.g. defining env variables). This is what shellHook does.

I hope I am clear.

Thank you again.
---
Pierre-Antoine Bouttier
GriCAD Research Engineer

GriCAD - https://gricad.univ-grenoble-alpes.fr/
Batiment IMAG
CS 40700
38058 Grenoble CEDEX 9

+33 4 57 42 18  66

> Le 10 mars 2021 à 15:07, zimoun <zimon.toutoune@gmail.com> a écrit :
> 
> 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-11  6:58 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
2021-03-11  6:57   ` Pierre-Antoine Bouttier [this message]
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=E92751B5-F3ED-47A0-B7D2-40F9D3F5C5B9@univ-grenoble-alpes.fr \
    --to=pierre-antoine.bouttier@univ-grenoble-alpes.fr \
    --cc=help-guix@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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).