From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wPnCBYvZVGA3LgAA0tVLHw (envelope-from ) for ; Fri, 19 Mar 2021 17:04:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mGmEAYvZVGB8KQAAbx9fmQ (envelope-from ) for ; Fri, 19 Mar 2021 17:04:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8FE691F08B for ; Fri, 19 Mar 2021 18:04:10 +0100 (CET) Received: from localhost ([::1]:60958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNIXh-0000ab-8t for larch@yhetil.org; Fri, 19 Mar 2021 13:04:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNIVh-0007p2-RL for guix-devel@gnu.org; Fri, 19 Mar 2021 13:02:06 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:58290 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNIVc-0003m8-SV for guix-devel@gnu.org; Fri, 19 Mar 2021 13:02:05 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1616173310; bh=fiknFUEXTBqswbErAUs/Pz9xd6zIiF9ReXeQtsmLyQ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=BUvWcWz+m+Ew4LHTZvMixkvdcDgxwYHTQ8RqokMpLE5OMLkP1p99w9J6u8oK6FBg7 X9WS4RvdL3xGQdhIDowc8ReOEsZSvgf1Rhdow/JTYQNHGRq3vDm2XYxXw5I7q6IPus wDv9zYNsnaR4/nhZTDtVzusmy4a+vHJ3F0LyklQk= To: Joshua Branson Subject: Re: Best practices for writing services In-Reply-To: <87h7l7p1gp.fsf@dismail.de> References: <878s6kqydj.fsf@yoctocell.xyz> <87h7l7p1gp.fsf@dismail.de> Date: Fri, 19 Mar 2021 18:01:49 +0100 Message-ID: <87tup713ia.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616173450; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=e8/qqGYQMNXDbM4Oj/VmbvE5Ti5XOGk4YRl4Ci4awxg=; b=UQVQ9+13Z99d3/MZqOj2gKl8jSdMRobof5lOIus2kJMgOifvT/rnhN1RMvXu2vWUd56yDs srFfyLG+d8NPWXLWhB4JJTYfRlnAZmhWCWvcxzgBUxEGGy3WPzVja8hzqvY3zyegNCIVA9 JZlJAj8tO80unO2yZm+w1aXl5v+zbmimcI1E4/pk5pXmGIXhDy0ZqIUuV46jT1tajc2rjI jabtMQWIQfdpSM47iO9y0Nw0XYXWHD1JYJeIBfa4V/DL+elhKQWH7kXLf2eBhvo+sAnp6d tQOauraWxt4+iZOIQwQuX7qjM5AebKRF3YlJGmO9+G+594twgpzkaz1aUSf1OQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616173450; a=rsa-sha256; cv=none; b=K+VTSjjgqOYyJV/bQfr/mXk3+1rX6+c3AaalqQvSglqsM4z5daa58GXHYvCZlrUoWSoXJu 0eIvVvRYyzjVJh2HxiP71IwutoJL/jTw2Kdp1zAdbDlyFgzJKfEH+5JgKwfiiSDxTt+cLV eQbF45/CEHCzu2ADPnaQQGpFNPTsP7hTPuBn8+ITQNfgupPiBbJ13iO4lbGcVHtJ3cfO5i pFM3bHOpyD8ML9pvvA8GRSm0iyrnKq0BsrmMcLZbyE2qw5aoMMGlLKoxn4waYiF7h2F564 T6ScMwrf0DFX9a5/wHOpFaRrMcQFHSsMVeQYHgX9K/cldnpRvLgCDrNSoUvi4g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=BUvWcWz+; dmarc=pass (policy=none) header.from=yoctocell.xyz; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=BUvWcWz+; dmarc=pass (policy=none) header.from=yoctocell.xyz; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 8FE691F08B X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: uQa78mL+5AFw 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.