help-guix
[Top][All Lists]
Advanced

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

Re: Defining custom services in /etc/config.scm


From: Sergiu Ivanov
Subject: Re: Defining custom services in /etc/config.scm
Date: Mon, 25 Jan 2021 21:50:51 +0100
User-agent: mu4e 1.4.13; emacs 27.1

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 via email to

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