From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Gibbons Subject: Re: Scripting guix in guile Date: Sat, 31 Aug 2019 11:52:44 -0600 Message-ID: <4ad98823cda464db40bb57dae87d8fe666963bf3.camel@gmail.com> References: <1909d3ec18a961a8d957d677e27fdcc05dd8608c.camel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i47YO-0007Rj-KC for help-guix@gnu.org; Sat, 31 Aug 2019 13:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i47YN-0003wy-Ev for help-guix@gnu.org; Sat, 31 Aug 2019 13:52:48 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:41293) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i47YN-0003vU-7O for help-guix@gnu.org; Sat, 31 Aug 2019 13:52:47 -0400 Received: by mail-pf1-x431.google.com with SMTP id 196so6567955pfz.8 for ; Sat, 31 Aug 2019 10:52:47 -0700 (PDT) In-Reply-To: <1909d3ec18a961a8d957d677e27fdcc05dd8608c.camel@gmail.com> 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: Konrad Hinsen , help-guix@gnu.org On Sat, 2019-08-31 at 11:38 -0600, Jesse Gibbons wrote: > On Sat, 2019-08-31 at 19:03 +0200, Konrad Hinsen wrote: > > Hi everyone, > > > > I'd like to write Guile scripts that inspect Guix, for example > > analyze > > the packages is my profile. That turned out to be a lot more > > difficult > > than I expected, and in fact I haven't found a satisfying general > > solution yet, meaning a script that I could publish in such a way > > that > > any Guix user could download and run it without modification. > > > > The problems I see are > > > > 1. What to put into the #! line to locate Guile. > > I don't think you need a shebang to script guile. Turns out you do. > If you do, you could always make a guix package for the scripts, and > that will fix everything in the patch-shebangs phase. If you package it for guix you can use it to develop your scripts as well. > > 2. How to construct the load path to make sure it includes > > Guix as installed under $HOME/.config/guix/current > > I think the default GUILE_LOAD_PATH includes guix. Here's the > contents > of mine: > ~$ ls $GUILE_LOAD_PATH > bytestructures git.scm gnutls guix.scm json.scm shepherd.scm > gcrypt gnu gnutls.scm ice-9/ mcron sqlite3.scm > git gnu.scm guix json shepherd ssh > > gnu/, gnu.scm, guix/, and guix.scm are all guix, and guix is not part > of my current profile. Note also most of these are prerequisites for > guix. > > > > I wonder if could somehow hijack 'guix repl', which solves these > > problems for a REPL but not for scripts. > > > > Any ideas? > > > > Konrad > > > > -You're writing tools for a package manager... try packaging those > tools for the package manager. It will take care of them like it > takes > care of everything else. > --You can wrap the executables with the environment variables you > need > so the executable scripts are callable from the default PATH. See > what > guix does with guile, mcron, and shepherd, which are mostly guile > scripts with a little bit of native code.