unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Guix home user-level shepherd services
@ 2022-06-15 23:18 Tangonov
  2022-06-15 23:28 ` Tangonov
  0 siblings, 1 reply; 7+ messages in thread
From: Tangonov @ 2022-06-15 23:18 UTC (permalink / raw)
  To: GUIX Help


[-- Attachment #1.1: Type: text/plain, Size: 1514 bytes --]


Hello Guix!

I don't seem to be able to start Shepherd services from my guix 
home config. The services fail to start, despite being startable 
from the command line from both reconfigure & container.

Here's what my services look like:

#+BEGIN_SRC scheme
(home-environment
 (packages
  (specifications->packages
   (append %base-packages
           %emacs
           %multimedia
           %browsers
           %chat-clients
           %devel)))
 (services
  (list ; ... bash services
        (service home-shepherd-service-type
                 (home-shepherd-configuration
                  (services (list
                             (shepherd-service
                              (provision '(syncthing))
                              (start #~(make-system-constructor 
                              "syncthing"))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Synchronize folders to other 
                               device"))
                             (shepherd-service
                              (provision '(pantalaimon))
                              (start #~(make-system-constructor 
                              "pantalaimon"))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Crypto back-end server for 
                               ement.el")))))))))
#+END_SRC

Thanks again for the help & software


[-- Attachment #1.2: Type: text/plain, Size: 16 bytes --]

-- 

- tangonov

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-15 23:18 Guix home user-level shepherd services Tangonov
@ 2022-06-15 23:28 ` Tangonov
  2022-06-16  1:09   ` Tangonov
  0 siblings, 1 reply; 7+ messages in thread
From: Tangonov @ 2022-06-15 23:28 UTC (permalink / raw)
  To: GUIX Help


[-- Attachment #1.1: Type: text/plain, Size: 2218 bytes --]

Oh! I almost forgot, the error messages from =guix home 
container=. It's worth mentioning that these are /user packages/. 
They're not installed on the root level.

#+BEGIN_QUOTE
Starting services...
Comparing /gnu/store/non-existing-generation/profile/share/fonts 
and
          /gnu/store/c04qxlqgawnbb0k08acwdd6sk2kjc1i2-home/profile/share/fonts... 
          done (same)
Evaluating on-change gexps.

On-change gexps evaluation finished.

sh: line 1: syncthing: command not found
Service syncthing could not be started.
sh: line 1: pantalaimon: command not found
Service pantalaimon could not be started.
#+END_QUOTE

Tangonov <tn@eml.cc> writes:

> Hello Guix! 
>
> I don't seem to be able to start Shepherd services from my guix 
> home config. The services fail to start, despite being
> startable from the command line from both reconfigure & 
> container. 
>
> Here's what my services look like: 
>
> (home-environment
>  (packages
>   (specifications->packages
>    (append %base-packages
>            %emacs
>            %multimedia
>            %browsers
>            %chat-clients
>            %devel)))
>  (services
>   (list ; ... bash services
>         (service home-shepherd-service-type
>                  (home-shepherd-configuration
>                   (services (list
>                              (shepherd-service
>                               (provision '(syncthing))
>                               (start #~(make-system-constructor 
>                               "syncthing"))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Synchronize folders to other 
>                                device"))
>                              (shepherd-service
>                               (provision '(pantalaimon))
>                               (start #~(make-system-constructor 
>                               "pantalaimon"))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Crypto back-end server for 
>                                ement.el")))))))))
>
> Thanks again for the help & software 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-15 23:28 ` Tangonov
@ 2022-06-16  1:09   ` Tangonov
  2022-06-16 16:19     ` Fredrik Salomonsson
  0 siblings, 1 reply; 7+ messages in thread
From: Tangonov @ 2022-06-16  1:09 UTC (permalink / raw)
  To: GUIX Help


[-- Attachment #1.1: Type: text/plain, Size: 3392 bytes --]

Ok, it seems as though I had some bash configuration issues. My 
"$(inline commands)" made things unhappy for some reason.

I resolved them, and shepherd started working...except that herd 
was totally bound up and not responsive. I had to kill it to 
reconfigure.

I assumed this is because the services were holding stuff up...so 
I tried a forked config:

#+BEGIN_SRC scheme
(service home-shepherd-service-type
                 (home-shepherd-configuration
                  (services (list
                             (shepherd-service
                              (provision '(syncthing))
                              (start #~(make-forkexec-constructor
                                        "syncthing" #:user #:t))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Synchronize folders to other 
                               device"))
                             (shepherd-service
                              (provision '(pantalaimon))
                              (start #~(make-forkexec-constructor
                                        "pantalaimon" #:user #:t))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Crypto back-end server for 
                               ement.el"))))))
#+END_SRC

The forked service does not seem to work :/

#+BEGIN_QUOTE
λ herd start pantalaimon
herd: exception caught while executing 'start' on service 
'pantalaimon':
Throw to key `match-error' with args `("match" "no matching 
pattern" "pantalaimon")'.
#+END_QUOTE

Tangonov <tn@eml.cc> writes:

> Oh! I almost forgot, the error messages from guix home 
> container. It's worth mentioning that these are user packages.
> They're not installed on the root level. 
>
>  Starting services… Comparing 
>  /gnu/store/non-existing-generation/profile/share/fonts and
>  /gnu/store/c04qxlqgawnbb0k08acwdd6sk2kjc1i2-home/profile/share/fonts… 
>  done (same) Evaluating on-change
>  gexps. 
>
>  On-change gexps evaluation finished. 
>
>  sh: line 1: syncthing: command not found Service syncthing 
>  could not be started. sh: line 1: pantalaimon: command
>  not found Service pantalaimon could not be started. 
>
> Tangonov <tn@eml.cc> writes: 
>
>  Hello Guix! 
>
>  I don't seem to be able to start Shepherd services from my guix 
>  home config. The services fail to start, despite being
>  startable from the command line from both reconfigure & 
>  container. 
>
>  Here's what my services look like: 
>
>  (home-environment (packages (specifications->packages (append 
>  %base-packages %emacs %multimedia %browsers
>  %chat-clients %devel))) (services (list ; … bash services 
>  (service home-shepherd-service-type
>  (home-shepherd-configuration (services (list (shepherd-service 
>  (provision '(syncthing)) (start
>  #~(make-system-constructor "syncthing")) (stop 
>  #~(make-kill-destructor)) (documentation "Synchronize folders 
>  to
>  other device")) (shepherd-service (provision '(pantalaimon)) 
>  (start #~(make-system-constructor "pantalaimon"))
>  (stop #~(make-kill-destructor)) (documentation "Crypto back-end 
>  server for ement.el"))))))))) 
>
>  Thanks again for the help & software 
>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-16  1:09   ` Tangonov
@ 2022-06-16 16:19     ` Fredrik Salomonsson
  2022-06-16 18:36       ` Tangonov
  0 siblings, 1 reply; 7+ messages in thread
From: Fredrik Salomonsson @ 2022-06-16 16:19 UTC (permalink / raw)
  To: Tangonov, GUIX Help

Hi Tangonov,

Tangonov <tn@eml.cc> writes:

> Ok, it seems as though I had some bash configuration issues. My 
> "$(inline commands)" made things unhappy for some reason.
>
> I resolved them, and shepherd started working...except that herd 
> was totally bound up and not responsive. I had to kill it to 
> reconfigure.
>
> I assumed this is because the services were holding stuff up...so 
> I tried a forked config:
>
> #+BEGIN_SRC scheme
> (service home-shepherd-service-type
>                  (home-shepherd-configuration
>                   (services (list
>                              (shepherd-service
>                               (provision '(syncthing))
>                               (start #~(make-forkexec-constructor
>                                         "syncthing" #:user #:t))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Synchronize folders to other 
>                                device"))
>                              (shepherd-service
>                               (provision '(pantalaimon))
>                               (start #~(make-forkexec-constructor
>                                         "pantalaimon" #:user #:t))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Crypto back-end server for 
>                                ement.el"))))))
> #+END_SRC
>
> The forked service does not seem to work :/
>
> #+BEGIN_QUOTE
> λ herd start pantalaimon
> herd: exception caught while executing 'start' on service 
> 'pantalaimon':
> Throw to key `match-error' with args `("match" "no matching 
> pattern" "pantalaimon")'.
> #+END_QUOTE
>

The issue is most likely that make-forkexec-constructor's COMMAND
argument expects a list of strings [0]. Try and see if this works:

#+BEGIN_SRC scheme
(service home-shepherd-service-type
                 (home-shepherd-configuration
                  (services (list
                             (shepherd-service
                              (provision '(syncthing))
                              (start #~(make-forkexec-constructor
                                        (list "syncthing") #:user #:t))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Synchronize folders to other 
                               device"))
                             (shepherd-service
                              (provision '(pantalaimon))
                              (start #~(make-forkexec-constructor
                                        (list "pantalaimon") #:user #:t))
                              (stop #~(make-kill-destructor))
                              (documentation
                               "Crypto back-end server for 
                               ement.el"))))))
#+END_SRC

[0] https://www.gnu.org/software/shepherd/manual/html_node/Service-De_002d-and-Constructors.html#Service-De_002d-and-Constructors

-- 
s/Fred[re]+i[ck]+/Fredrik/g


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-16 16:19     ` Fredrik Salomonsson
@ 2022-06-16 18:36       ` Tangonov
  2022-06-16 21:45         ` Fredrik Salomonsson
  2022-06-19 12:23         ` Efraim Flashner
  0 siblings, 2 replies; 7+ messages in thread
From: Tangonov @ 2022-06-16 18:36 UTC (permalink / raw)
  To: Fredrik Salomonsson; +Cc: GUIX Help


[-- Attachment #1.1: Type: text/plain, Size: 4207 bytes --]

Thanks Fredrik!

I really struggle with subtle details that are a few paragraphs 
deep, and so, I am embarassed.

If anyone else is reading this for reference: I should not have 
set =#:user #:t= for =make-forkexec-constructor=. The =#:user= 
keyword expects a string. My user is implicitly when left with the 
default value.

If I may say so, this has been easier to learn than systemd 
services. After many years of mostly failing to use systemd 
properly, I have not yet mastered it.

My user-level services are running :)

Fredrik Salomonsson <plattfot@posteo.net> writes:

> Hi Tangonov,
>
> Tangonov <tn@eml.cc> writes:
>
>> Ok, it seems as though I had some bash configuration issues. My 
>> "$(inline commands)" made things unhappy for some reason.
>>
>> I resolved them, and shepherd started working...except that 
>> herd 
>> was totally bound up and not responsive. I had to kill it to 
>> reconfigure.
>>
>> I assumed this is because the services were holding stuff 
>> up...so 
>> I tried a forked config:
>>
>> #+BEGIN_SRC scheme
>> (service home-shepherd-service-type
>>                  (home-shepherd-configuration
>>                   (services (list
>>                              (shepherd-service
>>                               (provision '(syncthing))
>>                               (start 
>>                               #~(make-forkexec-constructor
>>                                         "syncthing" #:user 
>>                                         #:t))
>>                               (stop #~(make-kill-destructor))
>>                               (documentation
>>                                "Synchronize folders to other 
>>                                device"))
>>                              (shepherd-service
>>                               (provision '(pantalaimon))
>>                               (start 
>>                               #~(make-forkexec-constructor
>>                                         "pantalaimon" #:user 
>>                                         #:t))
>>                               (stop #~(make-kill-destructor))
>>                               (documentation
>>                                "Crypto back-end server for 
>>                                ement.el"))))))
>> #+END_SRC
>>
>> The forked service does not seem to work :/
>>
>> #+BEGIN_QUOTE
>> λ herd start pantalaimon
>> herd: exception caught while executing 'start' on service 
>> 'pantalaimon':
>> Throw to key `match-error' with args `("match" "no matching 
>> pattern" "pantalaimon")'.
>> #+END_QUOTE
>>
>
> The issue is most likely that make-forkexec-constructor's 
> COMMAND
> argument expects a list of strings [0]. Try and see if this 
> works:
>
> #+BEGIN_SRC scheme
> (service home-shepherd-service-type
>                  (home-shepherd-configuration
>                   (services (list
>                              (shepherd-service
>                               (provision '(syncthing))
>                               (start 
>                               #~(make-forkexec-constructor
>                                         (list "syncthing") 
>                                         #:user #:t))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Synchronize folders to other 
>                                device"))
>                              (shepherd-service
>                               (provision '(pantalaimon))
>                               (start 
>                               #~(make-forkexec-constructor
>                                         (list "pantalaimon") 
>                                         #:user #:t))
>                               (stop #~(make-kill-destructor))
>                               (documentation
>                                "Crypto back-end server for 
>                                ement.el"))))))
> #+END_SRC
>
> [0] 
> https://www.gnu.org/software/shepherd/manual/html_node/Service-De_002d-and-Constructors.html#Service-De_002d-and-Constructors


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-16 18:36       ` Tangonov
@ 2022-06-16 21:45         ` Fredrik Salomonsson
  2022-06-19 12:23         ` Efraim Flashner
  1 sibling, 0 replies; 7+ messages in thread
From: Fredrik Salomonsson @ 2022-06-16 21:45 UTC (permalink / raw)
  To: Tangonov; +Cc: GUIX Help

Tangonov <tn@eml.cc> writes:

> Thanks Fredrik!
>

No problem.

> I really struggle with subtle details that are a few paragraphs 
> deep, and so, I am embarassed.
>

Don't be, hard to know where everything is. It took me a while to find
the docs for it as I was first looking for it in the Guix manual.

> If anyone else is reading this for reference: I should not have 
> set =#:user #:t= for =make-forkexec-constructor=. The =#:user= 
> keyword expects a string. My user is implicitly when left with the 
> default value.
>

I'm glad you figured it out! I totally missed the #:user option.

> If I may say so, this has been easier to learn than systemd 
> services. After many years of mostly failing to use systemd 
> properly, I have not yet mastered it.
>
> My user-level services are running :)

Great!

-- 
s/Fred[re]+i[ck]+/Fredrik/g


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix home user-level shepherd services
  2022-06-16 18:36       ` Tangonov
  2022-06-16 21:45         ` Fredrik Salomonsson
@ 2022-06-19 12:23         ` Efraim Flashner
  1 sibling, 0 replies; 7+ messages in thread
From: Efraim Flashner @ 2022-06-19 12:23 UTC (permalink / raw)
  To: Tangonov; +Cc: Fredrik Salomonsson, GUIX Help

[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]

On Thu, Jun 16, 2022 at 11:36:01AM -0700, Tangonov wrote:
> Thanks Fredrik!
> 
> I really struggle with subtle details that are a few paragraphs deep, and
> so, I am embarassed.
> 
> If anyone else is reading this for reference: I should not have set =#:user
> #:t= for =make-forkexec-constructor=. The =#:user= keyword expects a string.
> My user is implicitly when left with the default value.
> 
> If I may say so, this has been easier to learn than systemd services. After
> many years of mostly failing to use systemd properly, I have not yet
> mastered it.
> 
> My user-level services are running :)
> 

I'm a bit late, but I'm glad to see that its working for you. Here's
what I have in my user services for running syncthing:

(define %syncthing-user-service
  (shepherd-service
    (documentation "Run `syncthing' without calling the browser")
    (provision '(syncthing))
    (start #~(make-forkexec-constructor
               (list #$(file-append (S "syncthing") "/bin/syncthing")
                     "-no-browser")
               #:log-file (string-append #$%logdir "/syncthing.log")))
    (stop #~(make-kill-destructor))
    (respawn? #t)))

I have %logdir defined elsewhere as:
(define %logdir
  (or (getenv "XDG_LOG_HOME")
      (format #f "~a/.local/var/log"
              (getenv "HOME"))))

and S is specification->package.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-19 12:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 23:18 Guix home user-level shepherd services Tangonov
2022-06-15 23:28 ` Tangonov
2022-06-16  1:09   ` Tangonov
2022-06-16 16:19     ` Fredrik Salomonsson
2022-06-16 18:36       ` Tangonov
2022-06-16 21:45         ` Fredrik Salomonsson
2022-06-19 12:23         ` Efraim Flashner

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