[Top][All Lists]

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

Re: string-append plus package

From: Mathieu Lirzin
Subject: Re: string-append plus package
Date: Thu, 29 Dec 2016 14:06:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)


Hartmut Goebel <address@hidden> writes:

> 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).

The trick is that "…" in the above string depends on the actual hash 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

  (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.

Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

reply via email to

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