help-guix
[Top][All Lists]
Advanced

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

GuixSD Service Implementation Problem


From: Reza Alizadeh Majd
Subject: GuixSD Service Implementation Problem
Date: Fri, 28 Dec 2018 10:45:42 +0330

Hi, 

I'm working on an application which should be run as a service on GuixSD. 
I followed other service definitions and add my service definition file inside 
`GUIX_PACKAGE_PATH` path. but when I add this service to my system 
configuration file, and perform `guix system reconfigure /etc/config.scm`, 
receive following Error: 

```
ice-9/eval.scm:142:16: In procedure compile-top-call:
error: foo-service: unbound variable
hint: Did you forget `(use-modules (px services foo))'?
```

could anyone help me on this issue?


my system configuration file: 

```
(use-modules (gnu)
             (px services foo))
...

(operating-system
  ...
  
  (services (cons* 
               (foo-service)
                   (dhcp-client-service)
                   ...
               %base-services))

  (name-service-switch %mdns-host-lookup-nss))
  ```
  
my service definition:
        
```
(define-module (px services foo)
               #:use-module (gnu services)
               #:use-module (gnu services shepherd)
               #:use-module (px packages foo)
               #:use-module (guix qexp)
               #:use-module (guix records)
               #:use-module (ice-9 match)
               #:export (foo-service))

(define-record-type* <foo-configuration>
                     foo-configuration  make-foo-configuration
                     foo-configuration?
                     (package foo-configuration-package
                              (default foo-app)))

(define foo-shepherd-service
  (match-lambda
    (($ <foo-configuration> package)
     (list (shepherd-service
             (provision '(foo-service))
             (documentation "foo service")
             (requirement '(user-processes))
             (start #~((make-forkexec-constructor
                         (list
                           (string-append #$package "/bin/foo_app")))))
             (stop #~((make-kill-destructor))))))))


(define foo-service-type
  (service-type (name 'fooservice)
                (extensions
                  (list (service-extensions shepherd-root-service-type
                                            foo-shepherd-service)))))

(define* (foo-service #:key (package foo-app))
         "Foo Service"
         (service foo-service-type
                  (foo-configuration
                    (package package))))
```
  



reply via email to

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