From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: Re: string-append plus package Date: Thu, 29 Dec 2016 14:06:11 +0100 Message-ID: <8737h628cc.fsf@gnu.org> References: <20161208195647.GA23449@jasmine> <87h9608d3l.fsf@gnu.org> <3f930a82-663f-17ed-466c-d3bd021023d8@crazy-compilers.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:4830:134:3::10]:50514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMaPT-0003hh-1T for help-guix@gnu.org; Thu, 29 Dec 2016 08:06:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMaPS-0007SB-0s for help-guix@gnu.org; Thu, 29 Dec 2016 08:06:18 -0500 In-Reply-To: <3f930a82-663f-17ed-466c-d3bd021023d8@crazy-compilers.com> (Hartmut Goebel's message of "Thu, 29 Dec 2016 11:57:16 +0100") 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: Hartmut Goebel Cc: help-guix@gnu.org Hi, Hartmut Goebel writes: > Am 19.12.2016 um 10:47 schrieb Ludovic Court=C3=A8s: >> Hartmut Goebel skribis: >> >>> Am 08.12.2016 um 20:56 schrieb Leo Famulari: >>>>> Here is the service-definition I use: >>>>> >>>>> (nginx-service #:vhost-list >>>>> (list (nginx-vhost-configuration=20=20=20=20=20 >>>>> (root (string-append nginx "/share/nginx/html")) >>>> I believe that file-append is intended for this use case. >>> Maybe, but I can't get it to work. This minimal system declarision fails >>> with "In procedure string-append: Wrong type (expecting string): >>> #< base: #>> 2a236c0> suffix: ("/")>" >>> >>> (use-modules (gnu)) >>> (use-package-modules networking web) >>> (define NGINX (file-append nginx "/bin/nginxctl")) >>> (define TEST (string-append NGINX "")) >> [=E2=80=A6]For example: >> >> (scheme-file "foo" #~(foo bar #$(file-append nginx "/foo/bar"))) >> >> leads to a file =E2=80=9Cfoo=E2=80=9D containing: >> >> (foo bar "/gnu/store/=E2=80=A6-nginx-1.2.3/foo/bar") >> >> HTH! > > I now found time trying this out. Unfortunately this does not do what I > expect. I do not need some string "(foo bar > \"/gnu/store/=E2=80=A6-nginx-1.2.3/foo/bar\")". > > I need the string "/gnu/store/=E2=80=A6-nginx-1.2.3/bin/nginxctl". No gex= pr, no > scheme magic, no string representing scheme code. But simply a string > containing the path of a file with the package (nginx in the example) > which I can assign to some variable (NGINX as shown in the example) and > then be used for other string operations (like when defining TEST in the > example). The trick is that "=E2=80=A6" in the above string depends on the actual has= h of nginx which will change every time nginx (or its dependencies) is updated. So you need to "ask" the Guix API what is the string, like this: (use-modules (guix) (gnu packages web)) (define conn (open-connection)) (package-output conn nginx) ;returns the actual string However I guess this would not be that useful in the context of writing a service. --=20 Mathieu Lirzin GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37