* string-append plus package
@ 2016-12-08 17:01 Hartmut Goebel
2016-12-08 17:28 ` Thompson, David
2016-12-08 19:56 ` Leo Famulari
0 siblings, 2 replies; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-08 17:01 UTC (permalink / raw)
To: help-guix
Hi,
I'm confused about string-append working inconsistently:
In package definitions, I'm used to write '(string-append PKG "…")'. But
when I use this for defining a service, I get an error:
In procedure string-append: Wrong type (expecting string): #<package
nginx@1.11.6 gnu/packages/web.scm:124 42449c0>
What is going on here?
Here is the service-definition I use:
(nginx-service #:vhost-list
(list (nginx-vhost-configuration
(root (string-append nginx "/share/nginx/html"))
(https-port #f)
(ssl-certificate #f)
(ssl-certificate-key #f))))
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-08 17:01 string-append plus package Hartmut Goebel
@ 2016-12-08 17:28 ` Thompson, David
2016-12-08 17:46 ` Hartmut Goebel
2016-12-08 19:56 ` Leo Famulari
1 sibling, 1 reply; 17+ messages in thread
From: Thompson, David @ 2016-12-08 17:28 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
On Thu, Dec 8, 2016 at 12:01 PM, Hartmut Goebel
<h.goebel@crazy-compilers.com> wrote:
> Hi,
>
> I'm confused about string-append working inconsistently:
>
> In package definitions, I'm used to write '(string-append PKG "…")'. But
> when I use this for defining a service, I get an error:
>
> In procedure string-append: Wrong type (expecting string): #<package
> nginx@1.11.6 gnu/packages/web.scm:124 42449c0>
>
> What is going on here?
>
> Here is the service-definition I use:
>
> (nginx-service #:vhost-list
> (list (nginx-vhost-configuration
> (root (string-append nginx "/share/nginx/html"))
> (https-port #f)
> (ssl-certificate #f)
> (ssl-certificate-key #f))))
This isn't a bug. string-append is a procedure provided by Guile and
it only works on strings.
- Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-08 17:28 ` Thompson, David
@ 2016-12-08 17:46 ` Hartmut Goebel
2016-12-08 17:47 ` Thompson, David
0 siblings, 1 reply; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-08 17:46 UTC (permalink / raw)
To: Thompson, David; +Cc: help-guix
Am 08.12.2016 um 18:28 schrieb Thompson, David:
> This isn't a bug. string-append is a procedure provided by Guile and
> it only works on strings.
I don't care whether this is a bug or not. I need to get the package's
directory. And i works when using in a package definition.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-08 17:46 ` Hartmut Goebel
@ 2016-12-08 17:47 ` Thompson, David
0 siblings, 0 replies; 17+ messages in thread
From: Thompson, David @ 2016-12-08 17:47 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
On Thu, Dec 8, 2016 at 12:46 PM, Hartmut Goebel
<h.goebel@crazy-compilers.com> wrote:
> Am 08.12.2016 um 18:28 schrieb Thompson, David:
>> This isn't a bug. string-append is a procedure provided by Guile and
>> it only works on strings.
>
> I don't care whether this is a bug or not. I need to get the package's
> directory. And i works when using in a package definition.
Apologies Hartmut, I misread this as being sent to bug-guix.
- Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-08 17:01 string-append plus package Hartmut Goebel
2016-12-08 17:28 ` Thompson, David
@ 2016-12-08 19:56 ` Leo Famulari
2016-12-19 0:13 ` Hartmut Goebel
1 sibling, 1 reply; 17+ messages in thread
From: Leo Famulari @ 2016-12-08 19:56 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
On Thu, Dec 08, 2016 at 06:01:37PM +0100, Hartmut Goebel wrote:
> Hi,
>
> I'm confused about string-append working inconsistently:
>
> In package definitions, I'm used to write '(string-append PKG "…")'. But
> when I use this for defining a service, I get an error:
>
> In procedure string-append: Wrong type (expecting string): #<package
> nginx@1.11.6 gnu/packages/web.scm:124 42449c0>
>
> What is going on here?
>
> 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-08 19:56 ` Leo Famulari
@ 2016-12-19 0:13 ` Hartmut Goebel
2016-12-19 9:47 ` Ludovic Courtès
0 siblings, 1 reply; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-19 0:13 UTC (permalink / raw)
To: Leo Famulari; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]
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 nginx@1.11.6 gnu/packages/web.scm:126
2a236c0> suffix: ("/")>"
(use-modules (gnu))
(use-service-modules networking web)
(define NGINX (file-append nginx "/"))
(define TEST (string-append NGINX ""))
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
[-- Attachment #2: Type: text/html, Size: 1698 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-19 0:13 ` Hartmut Goebel
@ 2016-12-19 9:47 ` Ludovic Courtès
2016-12-19 11:05 ` Hartmut Goebel
2016-12-29 10:57 ` Hartmut Goebel
0 siblings, 2 replies; 17+ messages in thread
From: Ludovic Courtès @ 2016-12-19 9:47 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hartmut Goebel <h.goebel@crazy-compilers.com> 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 nginx@1.11.6 gnu/packages/web.scm:126
> 2a236c0> suffix: ("/")>"
>
> (use-modules (gnu))
> (use-service-modules networking web)
> (define NGINX (file-append nginx "/"))
> (define TEST (string-append NGINX ""))
The result of ‘file-append’ is not a string, but ‘string-append’ expects
two strings, hence the error.
‘file-append’ returns a “string-valued gexp”. This is to say that, in a
staging context, it will produce a string. 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!
Ludo’.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-19 9:47 ` Ludovic Courtès
@ 2016-12-19 11:05 ` Hartmut Goebel
2016-12-19 13:31 ` Ludovic Courtès
2016-12-29 10:57 ` Hartmut Goebel
1 sibling, 1 reply; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-19 11:05 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]
Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
> The result of ‘file-append’ is not a string, but ‘string-append’ expects
> two strings, hence the error.
>
> ‘file-append’ returns a “string-valued gexp”. This is to say that, in a
> staging context, it will produce a string. 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")
Thanks for the explanation (which to be frank would take me some time to
understand).
Please reread you answer from the point of view of an administrator or
somebody else who is not a Scheme programmer. Somebody who just wants to
get some system up an running. He would answer like this:
Parton? What? "string-valued gexp", "staging context"? I do not
care. I simply want to get the path to a file within a package.
Whatever you write above may be correct and may be understandable for
every Scheme programmer. But this is discouraging for everybody who does
not want to become a Scheme expert for administering his/her systems.
I already wasted about an hour just to try to get this path! This is crap!
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
[-- Attachment #2: Type: text/html, Size: 2165 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-19 11:05 ` Hartmut Goebel
@ 2016-12-19 13:31 ` Ludovic Courtès
2017-01-01 15:34 ` Hartmut Goebel
0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-12-19 13:31 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
> Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
>> The result of ‘file-append’ is not a string, but ‘string-append’ expects
>> two strings, hence the error.
>>
>> ‘file-append’ returns a “string-valued gexp”. This is to say that, in a
>> staging context, it will produce a string. 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")
>
> Thanks for the explanation (which to be frank would take me some time to
> understand).
>
> Please reread you answer from the point of view of an administrator or
> somebody else who is not a Scheme programmer. Somebody who just wants to
> get some system up an running. He would answer like this:
>
> Parton? What? "string-valued gexp", "staging context"? I do not
> care. I simply want to get the path to a file within a package.
>
> Whatever you write above may be correct and may be understandable for
> every Scheme programmer. But this is discouraging for everybody who does
> not want to become a Scheme expert for administering his/her systems.
>
> I already wasted about an hour just to try to get this path! This is crap!
I agree! The first two lines were all you wanted to know; the rest was
for you as someone who contributes to Scheme—I would not give that
explanation to someone who’s just trying to get nginx up and running.
As for the specifics of why ‘nginx-configuration’ makes this use case
complicated, I think we discussed it on guix-devel before, and there was
probably an action item, but “someone” just needs to make it happen or
at least to keep track of it.
HTH! :-)
Ludo’.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-19 13:31 ` Ludovic Courtès
@ 2017-01-01 15:34 ` Hartmut Goebel
2017-01-02 23:05 ` Ludovic Courtès
0 siblings, 1 reply; 17+ messages in thread
From: Hartmut Goebel @ 2017-01-01 15:34 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
Am 19.12.2016 um 14:31 schrieb Ludovic Courtès:
> I agree! The first two lines were all you wanted to know; the rest was
> for you as someone who contributes to Scheme—I would not give that
> explanation to someone who’s just trying to get nginx up and running.
My point is a different one: "The worm has to taste good to the fish,
not the fisherman."
GuixSD has a lot of outstanding features from which the system
declarations are one.
To make GuixSD successful – and not just another marginal distribution –
guix must support users and administrator to do there job. Otherwise
they will stay with other distributions. Administrators are typically
short in time and they are not programmes. If they are programming, they
are used to bash, perl, python and other imperative languages. Maybe
they have some experiences with tools like puppet or ansible, which
introduce some declarative paradigm.
Most admins are not used to functional programming nor scheme – and they
don't want to learn yet another language. They may be willing to learn
some patterns, but not to learn the language.
Compared with puppet and ansible, GuixSD system declarations have one
big draw-back already: The later work for GuixSD only, while puppet and
ansible can be used to manage all Gnu/Linux distributions and even Windows.
If now guix is inconsistent to use (see below), or uses some "magic", or
is complicated to learn, administrators will abstain from GuixSD.
So the road to success is based on on simplicity, consistency and no magic.
ATM, system declarations are *not* consistent: While in a package
description (gnu/packages/*.scm) and in service definitions
(gnu/service/*.scm) one can use "(string-append PACKAGE …)", this does
*not* work in system declarations (gnu/system/examples/*.tmpl). From an
administrators point of view, there is no reason for this different
behaviour. it's plain confusing.
Adding on this: I took two weeks (not counting the delay caused on my
side) to get a working answer for the simple question in this thread.
Imagine some admin trying ot GuixSD and being delayed that long. He/she
will just stop evaluating GuixSD.
If GuixSD should become successful, you need to change this.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2017-01-01 15:34 ` Hartmut Goebel
@ 2017-01-02 23:05 ` Ludovic Courtès
0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2017-01-02 23:05 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hi!
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
> To make GuixSD successful – and not just another marginal distribution –
> guix must support users and administrator to do there job. Otherwise
> they will stay with other distributions. Administrators are typically
> short in time and they are not programmes. If they are programming, they
> are used to bash, perl, python and other imperative languages. Maybe
> they have some experiences with tools like puppet or ansible, which
> introduce some declarative paradigm.
[...]
> If now guix is inconsistent to use (see below), or uses some "magic", or
> is complicated to learn, administrators will abstain from GuixSD.
>
> So the road to success is based on on simplicity, consistency and no magic.
Agreed!
> ATM, system declarations are *not* consistent: While in a package
> description (gnu/packages/*.scm) and in service definitions
> (gnu/service/*.scm) one can use "(string-append PACKAGE …)", this does
Not sure what you mean: (string-append PACKAGE STRING) never works if
PACKAGE is a package object.
> *not* work in system declarations (gnu/system/examples/*.tmpl). From an
> administrators point of view, there is no reason for this different
> behaviour. it's plain confusing.
>
> Adding on this: I took two weeks (not counting the delay caused on my
> side) to get a working answer for the simple question in this thread.
> Imagine some admin trying ot GuixSD and being delayed that long. He/she
> will just stop evaluating GuixSD.
>
> If GuixSD should become successful, you need to change this.
Agreed, except on one point: “we” instead of “you”. It’s a
collaborative effort and no single person can “get it right” and fix
every single issue.
User experience feedback like this is crucial if we are to improve
things.
As a “fisherman” like you wrote, there are many issues that I don’t even
notice. Reporting how the tool fails to meet your expectations like you
did is the first step towards improving it. It may be obvious to you
that something is broken here, but it was not obvious to me until you
described your expectations.
So, thanks for helping out!
Ludo’.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-19 9:47 ` Ludovic Courtès
2016-12-19 11:05 ` Hartmut Goebel
@ 2016-12-29 10:57 ` Hartmut Goebel
2016-12-29 13:06 ` Mathieu Lirzin
2016-12-30 23:42 ` Ludovic Courtès
1 sibling, 2 replies; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-29 10:57 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
> Hartmut Goebel <h.goebel@crazy-compilers.com> 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 nginx@1.11.6 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
Could you please correct my above example?. Thanks.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-29 10:57 ` Hartmut Goebel
@ 2016-12-29 13:06 ` Mathieu Lirzin
2016-12-29 14:21 ` Hartmut Goebel
2016-12-30 23:42 ` Ludovic Courtès
1 sibling, 1 reply; 17+ messages in thread
From: Mathieu Lirzin @ 2016-12-29 13:06 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hi,
Hartmut Goebel <h.goebel@crazy-compilers.com> writes:
> Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
>> Hartmut Goebel <h.goebel@crazy-compilers.com> 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 nginx@1.11.6 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
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.
--
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-29 13:06 ` Mathieu Lirzin
@ 2016-12-29 14:21 ` Hartmut Goebel
0 siblings, 0 replies; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-29 14:21 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: help-guix
Am 29.12.2016 um 14:06 schrieb Mathieu Lirzin:
> (use-modules (guix)
> (gnu packages web))
> (define conn (open-connection))
> (package-output conn nginx) ;returns the actual string
Thanks, based on this I made it work
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-29 10:57 ` Hartmut Goebel
2016-12-29 13:06 ` Mathieu Lirzin
@ 2016-12-30 23:42 ` Ludovic Courtès
2016-12-31 12:56 ` Hartmut Goebel
1 sibling, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-12-30 23:42 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hey Hartmut,
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
> Am 19.12.2016 um 10:47 schrieb Ludovic Courtès:
>> Hartmut Goebel <h.goebel@crazy-compilers.com> 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 nginx@1.11.6 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
items.)
Ludo’.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-30 23:42 ` Ludovic Courtès
@ 2016-12-31 12:56 ` Hartmut Goebel
2017-01-02 23:10 ` Ludovic Courtès
0 siblings, 1 reply; 17+ messages in thread
From: Hartmut Goebel @ 2016-12-31 12:56 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
Am 31.12.2016 um 00:42 schrieb Ludovic Courtès:
> Where does that string you want to build go to?
As I already wrote in my initial mail, I need to reference the actual
package output's path in some config-file within a system definition
(e.g. gnu/system/examples/nginx.tmpl).
So assume gnu/system/examples/nginx.tmpl to be:
(use-modules (gnu))
(use-package-modules networking web)
(define NGINX (package-output (open-connection) nginx))
(define TEST (string-append NGINX "/bin/nginxctl"))
If "package-output" is not the correct solution, please tell me the
correct one.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: string-append plus package
2016-12-31 12:56 ` Hartmut Goebel
@ 2017-01-02 23:10 ` Ludovic Courtès
0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2017-01-02 23:10 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: help-guix
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
> Am 31.12.2016 um 00:42 schrieb Ludovic Courtès:
>> Where does that string you want to build go to?
>
> As I already wrote in my initial mail, I need to reference the actual
> package output's path in some config-file within a system definition
> (e.g. gnu/system/examples/nginx.tmpl).
>
> So assume gnu/system/examples/nginx.tmpl to be:
>
> (use-modules (gnu))
> (use-package-modules networking web)
> (define NGINX (package-output (open-connection) nginx))
> (define TEST (string-append NGINX "/bin/nginxctl"))
>
> If "package-output" is not the correct solution, please tell me the
> correct one.
I think the discussion drifted a bit. Your initial message mentioned
this use case:
(nginx-service #:vhost-list
(list (nginx-vhost-configuration
(root (string-append nginx "/share/nginx/html"))
(https-port #f)
(ssl-certificate #f)
(ssl-certificate-key #f))))
I explained back in November what I think should be done to fix this (as
in: allow you to write (file-append nginx "/share/nginx/html") above):
https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00161.html
Julien submitted a patch just before the holidays that nobody has taken
the time to review yet. I’ll see if I can look at it tomorrow, but help
is always welcome!
Ludo’.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-01-02 23:10 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 17:01 string-append plus package Hartmut Goebel
2016-12-08 17:28 ` Thompson, David
2016-12-08 17:46 ` Hartmut Goebel
2016-12-08 17:47 ` Thompson, David
2016-12-08 19:56 ` Leo Famulari
2016-12-19 0:13 ` Hartmut Goebel
2016-12-19 9:47 ` Ludovic Courtès
2016-12-19 11:05 ` Hartmut Goebel
2016-12-19 13:31 ` Ludovic Courtès
2017-01-01 15:34 ` Hartmut Goebel
2017-01-02 23:05 ` Ludovic Courtès
2016-12-29 10:57 ` Hartmut Goebel
2016-12-29 13:06 ` Mathieu Lirzin
2016-12-29 14:21 ` Hartmut Goebel
2016-12-30 23:42 ` Ludovic Courtès
2016-12-31 12:56 ` Hartmut Goebel
2017-01-02 23:10 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).