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.touto...@gmail.com> a écrit : > > Hi Pierre-Antoine, > > On Tue, 09 Mar 2021 at 17:23, Pierre-Antoine Bouttier > <pierre-antoine.boutt...@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