[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-append plus package

From: Ludovic Courtès
Subject: Re: string-append plus package
Date: Sat, 31 Dec 2016 00:42:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hey Hartmut,

Hartmut Goebel <address@hidden> skribis:

> Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
>> Hartmut Goebel <address@hidden> 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     
>>>>>                       (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):
>>> #<<file-append> base: #<package address@hidden gnu/packages/web.scm:126
>>> 2a236c0> suffix: ("/")>"
>>> (use-modules (gnu))
>>> (use-package-modules networking web)
>>> (define NGINX (file-append nginx "/bin/nginxctl"))
>>> (define TEST (string-append NGINX ""))
>> […]For example:
>>   (scheme-file "foo" #~(foo bar #$(file-append nginx "/foo/bar")))
>> leads to a file “foo” containing:
>>   (foo bar "/gnu/store/…-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/…-nginx-1.2.3/foo/bar\")".
> I need the string "/gnu/store/…-nginx-1.2.3/bin/nginxctl". No gexpr, 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 …" 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
‘file-append’ or the solution that Mathieu outlined with
‘package-output’ (the latter looks simpler but is also more “risky” in
that that you could end up with strings that refer to nonexistent store


reply via email to

[Prev in Thread] Current Thread [Next in Thread]