From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aJrMIZ0Ix16hSAAA0tVLHw (envelope-from ) for ; Thu, 21 May 2020 23:02:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AAXdHZ0Ix15TBQAAB5/wlQ (envelope-from ) for ; Thu, 21 May 2020 23:02:53 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A5F399400C3 for ; Thu, 21 May 2020 23:02:52 +0000 (UTC) Received: from localhost ([::1]:44106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbuDB-0002R6-8S for larch@yhetil.org; Thu, 21 May 2020 19:02:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbuD4-0002Qz-Nl for help-guix@gnu.org; Thu, 21 May 2020 19:02:42 -0400 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:35395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbuD3-0001Dl-T5 for help-guix@gnu.org; Thu, 21 May 2020 19:02:42 -0400 Received: by mail-qt1-x82e.google.com with SMTP id z18so6961609qto.2 for ; Thu, 21 May 2020 16:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MeHZcAL4YDj3RgHzQYhJQ+FmBh13oOBoyOZJODhMhZo=; b=CdJO6HlceQmEQMa7lRRmoZY30ircpCBs8GyGKMRaAHPAdddM6VXTjdixIARfhVOM52 R6QhDh+GJ7cd+Kodnyg5iN1272ygQUndg1pP9puaj2ZsNbfJr+9tNVOyR6FsbYw90c8C UWSrsAJpS/vIEYghvOqmnf5j+rYPOfmE1LvDOPNjnDF0GjU+MpxuksBvGE86txFXhPxU Y/TRG5jH6rzM9aObFqegeJ4/djG8UV14hTDOmjetxYQaz1Xka+HS0uE8B72rYDjxsU6H b+DJYQZenxnt3+DOR2UloeXas0MrigAiszZd/XGXV56bTU0c8t/osu2FsLw/mK8VXyyj a3Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MeHZcAL4YDj3RgHzQYhJQ+FmBh13oOBoyOZJODhMhZo=; b=ZMP5pX8DLbCFBJUftBQSCG2YzWWR5fTohBbKKLLoowrP2ODNuqpLul7iC9WE1eHQo+ y3/9OxJC9+3kgac577kOTBxocr44sWGbxL6oS5n/VYM/6eyTx4KAoS83XoeR8hkSZ7FE dAQ4oUi77V7flbX9ja4PhvlhurB5b3gikIrLxFPUV/82s1+ylmeRHm1GprbQ0fP9Nlhm GNMAvLVCh5JZaCV6LWiTggMo/11o73tCgjPC+Oj4AV1aB2/XAYN4HHBykkiu6/ZLK7/7 2wLoVka8eD2yndF1bLh8uwj4CHVNfM0AxBGrmo4mWyAffuiyuPFdFheVrvwgDLZe9WXm fKOQ== X-Gm-Message-State: AOAM530gQ1kI3ertUB8InV2pGKBoP1DzbIoCVMbQ88cUIa12iR+c91Kh 7H7u2gFbSS6jdl/r6N/P0d6+RZ8nZcYdqjYYNjo= X-Google-Smtp-Source: ABdhPJy59n/LGppH/QCE1yz0zj7C6hOF7/RmSI2XSMbyj0KY3xeTbF0Zf8qGt7WgFRbRHOy3SauHGG0HLteV9GjgBOE= X-Received: by 2002:ac8:4403:: with SMTP id j3mr13342773qtn.186.1590102160691; Thu, 21 May 2020 16:02:40 -0700 (PDT) MIME-Version: 1.0 References: <17234059da3.b5e01d1e8240.9032082708652182693@zoho.com> <878shla245.fsf@devup.no> <17238fa6f3f.1085042d523521.3962992471488424781@zoho.com> <87tv0980yc.fsf@devup.no> In-Reply-To: <87tv0980yc.fsf@devup.no> From: zimoun Date: Fri, 22 May 2020 01:02:29 +0200 Message-ID: Subject: Re: Appropriate way to use Guix API from a Guile program To: Marius Bakke Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=zimon.toutoune@gmail.com; helo=mail-qt1-x82e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Help Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=CdJO6Hlc; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: c2Pt21hecoo6 Dear sirgazil, On Thu, 21 May 2020 at 22:53, Marius Bakke wrote: > sirgazil writes: > > Hmm, and is there any way for a Guile program installed as a Guix package to use the modules of the Guix obtained by the user with "guix pull" and also being able to take advantage of user-defined channels? Or is this just not possible at all? > > You need to add $HOME/.config/guix/current/share/guile/site/3.0 on > GUILE_LOAD_PATH to access channel code from Guile programs. If you feel in an experimental mood, you can try the Konrad's patch [1]. It sets up the PATH accordingly and hides all the internals. Well, "guix repl" launches a REPL with the current Guix modules available and the patch extends that to scripts: "guix repl foo.scm". Note that '--load-path' is supported so you can extend by your own modules too. Last, command-line arguments passed to the scripts are not supported (yet). Well, if it is a script without command-line argument, then "guix repl foo.scm" is the thing that you would want, I guess. If it is a script with command-line argument, then extend "GUILE_LOAD_PATH" by '~/.config/guix/current/share/guile/site/3.0' and run "guile foo.scm arg1 arg2" is the thing that you would want, I guess. Be careful to not mix the modules from the package named 'guix' -- modules installed with "guix install guix" -- and the modules of the current Guix -- modules under ~/.config/guix/current/share/guile/site/3.0. I did the mistake once. :-) [1] http://issues.guix.gnu.org/41253 Hope that helps, simon