From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Defining shepherd user services -- feedback desired Date: Mon, 05 Feb 2018 12:03:36 +0100 Message-ID: <871shzhf5j.fsf@gnu.org> References: <87bmh5o8ux.fsf@librem.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eieYq-0002n3-B0 for guix-devel@gnu.org; Mon, 05 Feb 2018 06:03:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eieYl-0003IH-28 for guix-devel@gnu.org; Mon, 05 Feb 2018 06:03:44 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:39224) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eieYk-0003HY-SU for guix-devel@gnu.org; Mon, 05 Feb 2018 06:03:39 -0500 In-Reply-To: <87bmh5o8ux.fsf@librem.i-did-not-set--mail-host-address--so-tickle-me> (Alex ter Weele's message of "Sat, 03 Feb 2018 19:13:10 -0600") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Alex ter Weele Cc: guix-devel@gnu.org Hey Alex, Alex ter Weele skribis: > Attached is a manifest file which allows a user to write a > shepherd-service like the following: > > (define redshift-service > (shepherd-service > (provision '(redshift)) > (modules `((gnu packages xdisorg) > ,@%default-modules)) > (start #~(make-forkexec-constructor > (list (string-append #$redshift "/bin/redshift") > "-l" "50:4"))))) > > And transform it into a package: > > (services->package (list redshift-service)) > > This allows it to be included in a user's profile. This unites the > definition of a service with its dependencies (redshift, in the example > above). A user would not have to install a package just to use it as a > service, nor would they have to hand-write a Shepherd configuration > file. Indeed, that=E2=80=99s a neat hack! And it ties software and service deployment, which is great. > ;; the next two are copied from (gnu services shepherd) because: > > ;; * (gnu services shepherd)'s version of shepherd-configuration-file > ;; is for the pid1 shepherd and has some stuff like fallback-to-REPL > ;; that is not necessary for user services. > > ;; * (gnu services shepherd) doesn't export > ;; shepherd-configuration-file. That we can fix. :-) Would it be enough for you? I don=E2=80=99t think the first item is a showstopper, is it? > (define (services->package services) > "Yield a package for SERVICES by making them into a shepherd > configuration file via scheme-file." This makes me think that perhaps we should generalize profile, and allow non-package objects in there=E2=80=94it doesn=E2=80=99t feel right to defin= e a for something that=E2=80=99s conceptually not a package at all. But then that leads to issues, like what should =E2=80=98guix package -u=E2= =80=99 do? How should ~/.guix-profile/manifest represent these non-package things? Should we add =E2=80=98guix package --install-service=E2=80=99 or similar? = (Well, that may be overboard=E2=80=A6) It would be nice to think about whether/how we could make this part of Guix proper. Thanks! Ludo=E2=80=99.