* nix shellHook equivalent for guix environment? @ 2021-03-09 16:23 Pierre-Antoine Bouttier 2021-03-10 14:07 ` zimoun 2021-03-10 15:03 ` Xinglu Chen 0 siblings, 2 replies; 5+ messages in thread From: Pierre-Antoine Bouttier @ 2021-03-09 16:23 UTC (permalink / raw) To: help-guix Dear all, 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) Best regards --- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nix shellHook equivalent for guix environment? 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 2021-03-10 15:03 ` Xinglu Chen 1 sibling, 1 reply; 5+ messages in thread From: zimoun @ 2021-03-10 14:07 UTC (permalink / raw) To: Pierre-Antoine Bouttier, help-guix 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nix shellHook equivalent for guix environment? 2021-03-10 14:07 ` zimoun @ 2021-03-11 6:57 ` Pierre-Antoine Bouttier 0 siblings, 0 replies; 5+ messages in thread From: Pierre-Antoine Bouttier @ 2021-03-11 6:57 UTC (permalink / raw) To: zimoun; +Cc: help-guix 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nix shellHook equivalent for guix environment? 2021-03-09 16:23 nix shellHook equivalent for guix environment? Pierre-Antoine Bouttier 2021-03-10 14:07 ` zimoun @ 2021-03-10 15:03 ` Xinglu Chen 2021-03-11 6:58 ` Pierre-Antoine Bouttier 1 sibling, 1 reply; 5+ messages in thread From: Xinglu Chen @ 2021-03-10 15:03 UTC (permalink / raw) To: Pierre-Antoine Bouttier, help-guix Hi! On Tue, Mar 09 2021, Pierre-Antoine Bouttier wrote: > Dear all, > > 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 am not aware of a guix environment equivalent to shellHook, but I suggest you checking out direnv[1]. It allows you to setup an environment on a per-directory basis, everytime you enter a directory the content of the `.envrc` file will be run in your shell. There is also integration with Guix[2] so you could have an `.envrc` file like this: --8<---------------cut here---------------start------------->8--- use_guix <some-package> --ad-hoc git -L manifest.scm echo "Environment created!" [...] --8<---------------cut here---------------end--------------->8--- [1] https://direnv.net/ [2] https://github.com/direnv/direnv/wiki/GNU-Guix -- Xinglu Chen ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nix shellHook equivalent for guix environment? 2021-03-10 15:03 ` Xinglu Chen @ 2021-03-11 6:58 ` Pierre-Antoine Bouttier 0 siblings, 0 replies; 5+ messages in thread From: Pierre-Antoine Bouttier @ 2021-03-11 6:58 UTC (permalink / raw) To: Xinglu Chen; +Cc: help-guix Hi, thank you for pointing this. I will check if it can fit my needs. Best --- 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 à 16:03, Xinglu Chen <public@yoctocell.xyz> a écrit : > > Hi! > > On Tue, Mar 09 2021, Pierre-Antoine Bouttier wrote: > >> Dear all, >> >> 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 am not aware of a guix environment equivalent to shellHook, but I > suggest you checking out direnv[1]. It allows you to setup an > environment on a per-directory basis, everytime you enter a directory > the content of the `.envrc` file will be run in your shell. > > There is also integration with Guix[2] so you could have an `.envrc` > file like this: > > --8<---------------cut here---------------start------------->8--- > use_guix <some-package> --ad-hoc git -L manifest.scm > > echo "Environment created!" > > [...] > --8<---------------cut here---------------end--------------->8--- > > [1] https://direnv.net/ > [2] https://github.com/direnv/direnv/wiki/GNU-Guix > > -- > Xinglu Chen ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-11 6:59 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2021-03-10 15:03 ` Xinglu Chen 2021-03-11 6:58 ` Pierre-Antoine Bouttier
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.