From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: string-append plus package Date: Sat, 31 Dec 2016 00:42:37 +0100 Message-ID: <87wpeh6l1u.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]:43077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN6ov-0004RR-8d for help-guix@gnu.org; Fri, 30 Dec 2016 18:42:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cN6oq-00067z-CR for help-guix@gnu.org; Fri, 30 Dec 2016 18:42:45 -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 Hey Hartmut, Hartmut Goebel skribis: > 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). > > I tried adopting your example but #~ always gave me a gexp, which of > course I can't use in string-append. > > The manual says "Gexps are meant to be written to a file =E2=80=A6" so I = assume > "file-append" is the wrong approach at all Where does that string you want to build go to? Depending on the answer, the solution would be either a gexp with =E2=80=98file-append=E2=80=99 or the solution that Mathieu outlined with =E2=80=98package-output=E2=80=99 (the latter looks simpler but is also more= =E2=80=9Crisky=E2=80=9D in that that you could end up with strings that refer to nonexistent store items.) Ludo=E2=80=99.