From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Hinsen Subject: Re: Scripting guix in guile Date: Wed, 04 Sep 2019 12:42:41 +0200 Message-ID: References: <1909d3ec18a961a8d957d677e27fdcc05dd8608c.camel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58462) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5SkQ-00081y-Tj for help-guix@gnu.org; Wed, 04 Sep 2019 06:42:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5SkP-0005BF-Ln for help-guix@gnu.org; Wed, 04 Sep 2019 06:42:46 -0400 In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Jesse Gibbons , help-guix@gnu.org Hi Jesse and Ludo, Jesse Gibbons writes: > 1. Tell your audience to call "guile " when running the > script. That's very reasonable, but... > This does not garuntee guix is in their GUILE_LOAD_PATH though, so you > will either need to tell them to add a segment to .bashrc to add the > guix source location to their GUILE_LOAD_PATH or have them use the -L > flag to have guile search that directory. that sounds a bit complicated to explain, especially since they first have to figure out the correct path segment to add, which depends on how Guix was installed. > 2. Instruct the audience to use features of guix when playing with the > script: Some of those are in fact my main topic (which will be part of a tutorial on managing software environments for reproducible research). But I want to keep technical details to a minimum for an introduction to Guix. > 3. I think you can use autogen to find out where guile and guix are > located and use that location in the shebang and in a script that adds > guix to GUILE_LOAD_PATH. This is a bit complicated though, and you will > need to make sure your audience has autogen before they can do > anything. I don't even use autogen myself, so that's perhaps not the right approach... Ludovic Court=C3=A8s writes: >> 1. What to put into the #! line to locate Guile. > > On Guix System #!/run/current-system/profile/bin/guile is very likely to > work :-), but on other systems you could use =E2=80=9C#!/usr/bin/env guil= e=E2=80=9D I > suppose. True. But I'd prefer something that works on both! >> 2. How to construct the load path to make sure it includes >> Guix as installed under $HOME/.config/guix/current > > That=E2=80=99s indeed annoying. I think we should add =E2=80=98-s=E2=80= =99 and similar flags > that =E2=80=98guile=E2=80=99 supports to =E2=80=98guix repl=E2=80=99. That sounds like a good idea, though I'd probably use "guix script" or something similar rather than overload "repl". > In the meantime, as Jesse suggested, you could arrange to have both > =E2=80=98guix=E2=80=99 (the package) and =E2=80=98guile=E2=80=99 in a pro= file, such that Guix and its > dependencies are available in $GUILE_LOAD_PATH. That's what I thought would work, but it doesn't: $ which guix /home/hinsen/.guix-profile/guix $ which guile /home/hinsen/.guix-profile/guile $ echo $GUILE_LOAD_PATH /home/hinsen/.guix-profile/share/guile/site/2.2 $ ls $GUILE_LOAD_PATH emacs-guix emacs-guix.scm gcrypt That's with a Guix install under Ubuntu. >=C2=B4 As for inspecting the installed packages, the entry point is (guix > profiles), which has everything you need to grab info about a profile. Indeed, together with (guix packages) that's enough for exploring a profile or environment, which is my main topic. My scripts output stuff like (transitive-manifest-entries ...) or (package-closure ...) in a readable format, to let users get a better idea of what their code really depends on, and how. Cheers, Konrad.