all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reza Alizadeh Majd <r.majd@pantherx.org>
To: help-guix@gnu.org
Subject: GuixSD Service Implementation Problem
Date: Fri, 28 Dec 2018 10:45:42 +0330	[thread overview]
Message-ID: <1545981342.3441606.1619766344.1BA0B5B7@webmail.messagingengine.com> (raw)

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	other threads:[~2018-12-28  7:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1545981342.3441606.1619766344.1BA0B5B7@webmail.messagingengine.com \
    --to=r.majd@pantherx.org \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.