help-guix
[Top][All Lists]
Advanced

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

Re: nix shellHook equivalent for guix environment?


From: zimoun
Subject: Re: nix shellHook equivalent for guix environment?
Date: Wed, 10 Mar 2021 15:07:19 +0100

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 via email to

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