unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Sergiu Ivanov <sivanov@colimite.fr>
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: help-guix@gnu.org
Subject: Re: Defining custom services in /etc/config.scm
Date: Mon, 25 Jan 2021 21:50:51 +0100	[thread overview]
Message-ID: <87im7kbv10.fsf@colimite.fr> (raw)
In-Reply-To: <87wnw2ynuh.fsf@zancanaro.id.au>

Hi Carlo,

Thanks a lot for your answer !


Thus quoth  Carlo Zancanaro  on Sun Jan 24 2021 at 23:25 (+0100):
> On Mon, Jan 25 2021, Sergiu Ivanov wrote:
>> I understand that I should somehow construct a <service> (?) from my
>> <shepherd-service>, but I don't see a way to do it.
>
> Unfortunately Guix overloads the word "service", where we have (a)
> services that consist of structured modifications to an operating 
> system, and (b) shepherd services that define a process that will run
> on the resulting system.

A-ha, OK, I vaguely felt this distinction, but I wasn't sure.

> Shepherd services cannot be used directly, but need to be added to an
> instance of the shepherd-root-service-type service. The easiest way to
> do this is to use simple-service (documented in "(guix) Service
> Reference" in the manual).
>
> Putting it together, this should return a service object which runs
> your redshift shepherd service:
>
>  (simple-service 'redshift-service 'shepherd-root-service-type   (list
> redshift-service))
>
> I hope that helps!

This helped indeed: my redshift-service got integrated into the system
service tree.  You solved my frustration: I thought I understood almost
everything I needed from the documentation, but I couldn't put the
pieces together.  Invoking simple-service in this way made the pieces
click; I'm happy.

Still, I'll go with Shepherd user services:

  https://guix.gnu.org/blog/2020/gnu-shepherd-user-services/

Running redshift as a system service, even as my user, prevents it from
easily detecting my X session.  Also, I realized that I could even run
mcron as a user service, which actually makes several things
somewhat easier.

I initially hoped to cram as much as I could into /etc/config.scm (in
particular because guix-home-manager looks a lot less evolved than Nix's
home-manager (and that's an opportunity to contribute, but I need to get
a better grasp on Guix first)), but after all having a couple user files
written in Guile is not a big issue, because the uniformity of the
configuration language is more important for me.

-
Sergiu


      reply	other threads:[~2021-01-25 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 19:09 Defining custom services in /etc/config.scm Sergiu Ivanov
2021-01-24 19:19 ` Ekaitz Zarraga
2021-01-24 19:59   ` Sergiu Ivanov
2021-01-24 22:25 ` Carlo Zancanaro
2021-01-25 20:50   ` Sergiu Ivanov [this message]

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=87im7kbv10.fsf@colimite.fr \
    --to=sivanov@colimite.fr \
    --cc=carlo@zancanaro.id.au \
    --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.
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).