unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: Joshua Branson <jbranso@dismail.de>
Cc: guix-devel@gnu.org
Subject: Re: Best practices for writing services
Date: Fri, 19 Mar 2021 18:01:49 +0100	[thread overview]
Message-ID: <87tup713ia.fsf@yoctocell.xyz> (raw)
In-Reply-To: <87h7l7p1gp.fsf@dismail.de>

On Fri, Mar 19 2021, Joshua Branson wrote:

>> Currently there seems to be two main ways to do this, the first one
>> is the define one or more records for the configuration field of a
>> service using `define-record-type*`, see the tor service in (gnu
>> services networking) for example.  The other method is to use
>> `define-configuration` to declare the configuration fields of a service,
>> see the transmission service in (gnu services file-sharing) for example.
>
> I believe that the first method via define-record-type* seems to be the
> recommended method to do this.  I only say that because I feel like more
> services are defined that way now.  :)

I decided to use `define-record-type*` since the service for mcron is
pretty simple because it is already configured in Guile. :)

> I've been working on a sway service and an endlessh service in my
> hacking videos
> (https://video.hardlimit.com/accounts/joshua_branson/video-channels).

Cool, great to see more videos on Guix, and it's on PeerTube.

> I was running into issues, where I could compile the service, but
> trying to reconfigure my system would result in errors.

The Guile compiler seems to miss quite a few errors in my exprience too.

> The errors messages were a little vague.  I will also say that the
> better method I have found in writing a guix service is to
>
> 1) write the service as simply as possible first.  I personally would
> copy the simplest service that you can find in gnu/services/  and modify
> that via a M-x anzu-query-replace-regexp.  If re-configuring works, make a commit.
>
> 2) If possible, containerize the service.  If it works, make a commit.
>
> 3) Now start adding in all the features you left out before.

Thanks for the suggestions, I will take them into account in the future.



  reply	other threads:[~2021-03-19 17:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 15:23 Best practices for writing services Xinglu Chen
2021-03-19 16:12 ` Joshua Branson
2021-03-19 17:01   ` Xinglu Chen [this message]
2021-04-21  3:54 ` Maxim Cournoyer
2021-04-21 10:45   ` Xinglu Chen
2021-04-21 18:05     ` Maxim Cournoyer
2021-04-22  7:27       ` Xinglu Chen
2021-04-23  4:42         ` Maxim Cournoyer
2021-04-23  6:04           ` Xinglu Chen
2021-04-21 22:10     ` raingloom
2021-04-22  7:19       ` Xinglu Chen
2021-04-26 20:29         ` raingloom

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87tup713ia.fsf@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=guix-devel@gnu.org \
    --cc=jbranso@dismail.de \
    /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 public inbox

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

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