From patchwork Sun Aug 6 21:07:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52594 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 536B427BBE9; Sun, 6 Aug 2023 22:08:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 308E227BBEA for ; Sun, 6 Aug 2023 22:08:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkyq-0006ub-Kq; Sun, 06 Aug 2023 17:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyp-0006uJ-3S for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkyo-0001Si-Rm for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyo-0005i7-M0 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 1/8] services: dicod: Remove Shepherd < 0.9.0 compatibility layer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135607921902 (code B ref 65119); Sun, 06 Aug 2023 21:08:02 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:07:59 +0000 Received: from localhost ([127.0.0.1]:60113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyk-0005hA-VN for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyj-0005gh-1H for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyd-0001KF-Bg; Sun, 06 Aug 2023 17:07:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=f0S4euUQyfFc7dsUsVwhlg2qZBLmprMXarjNkyW8rFM=; b=WBEDwVTD0K3Y/mj8y1vv bhoIybbpzZb3SOlVuGDkwv0I+clb2uHQ6ynG1FJxrRpxC6nd7zGYR0F/1qyIbKMFHxWRdNPmxhzLu G/9X4Cl/PhlRBJot5PRaPsgoymnJOrAK4/6fc2CXI3s3RfnJcH3jQ68ANVrahAz5y/pHXBLJvwR6S +r1gQgIaOCtaX0O1h/FLFoaJ4pJrnj/2CSqmvrhG2Av6Qc+1SwQYZmpd5wW8baBOu9oBzI6fDh0/j hsKodjPNI45jqmQskybjDLWVTnQsLt6F/hfzCuyw1AKLpRkXyoAT9SDJxNuuhizvEBKOv2Gp3SNvO 6qYgBQnmNh406w==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:28 +0200 Message-ID: <5301257cba680ba2d4ab7115c1712090276a1f46.1691355218.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/dict.scm (dicod-shepherd-service): Use 'make-inetd-constructor' and 'make-inetd-destructor' unconditionally. --- gnu/services/dict.scm | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index 23e1d36364..7d48953ef1 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -167,25 +167,18 @@ (define (dicod-shepherd-service config) (provision '(dicod)) (requirement '(user-processes)) (documentation "Run the dicod daemon.") - (start #~(if (defined? 'make-inetd-constructor) - (make-inetd-constructor - (list #$dicod "--inetd" "--foreground" - (string-append "--config=" #$dicod.conf)) - (map (lambda (interface) - (endpoint - (addrinfo:addr - (car (getaddrinfo interface "dict"))))) - '#$interfaces) - #:requirements '#$requirement - #:user "dicod" #:group "dicod" - #:service-name-stem "dicod") - (make-forkexec-constructor - (list #$dicod "--foreground" - (string-append "--config=" #$dicod.conf)) - #:user "dicod" #:group "dicod"))) - (stop #~(if (defined? 'make-inetd-destructor) - (make-inetd-destructor) - (make-kill-destructor))) + (start #~(make-inetd-constructor + (list #$dicod "--inetd" "--foreground" + (string-append "--config=" #$dicod.conf)) + (map (lambda (interface) + (endpoint + (addrinfo:addr + (car (getaddrinfo interface "dict"))))) + '#$interfaces) + #:requirements '#$requirement + #:user "dicod" #:group "dicod" + #:service-name-stem "dicod")) + (stop #~(make-inetd-destructor)) (actions (list (shepherd-configuration-action dicod.conf))))))) (define dicod-service-type From patchwork Sun Aug 6 21:07:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52596 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B984527BBEA; Sun, 6 Aug 2023 22:08:36 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AF19827BBE2 for ; Sun, 6 Aug 2023 22:08:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkyq-0006ug-PX; Sun, 06 Aug 2023 17:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyq-0006uS-2t for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkyp-0001St-RK for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyp-0005iO-M8 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 2/8] services: dicod: Pre-build the GCIDE index. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608021914 (code B ref 65119); Sun, 06 Aug 2023 21:08:03 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:00 +0000 Received: from localhost ([127.0.0.1]:60117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyl-0005hD-Fa for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyj-0005gi-B8 for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkye-0001LK-5L; Sun, 06 Aug 2023 17:07:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=s4WQB/tfmyS1mU3k9b5GTVQlS/7665GzIsiFRmxmjXQ=; b=FQO8bRCN/15jgvW6vXmM n0Bcmorbmm42Ur+mYo+ptB9fwFW5/Rz8ofyhI+ogSXpoLrR2vJDBpEz21Zkx27OaFWZ2l8rYJdjUk 5WJImPVgIRz5DiUtSK36G6TSq12gOVsUyasMAoQaZD2/vhGFMyz3BG+RkUy8wWp1cxeaW4duoCUG2 8IJwbZEyoCEGRgbqYqpmQ2roYhP0T44U4tKknRd+zbAs8JUs3KInqgWrk/33+YS1kLQVnRGXTOyGQ b8jtquu3gfLNtI5YoPllSuQwC2cHRck2t9qARxTkHDauLlkagzBUVjpAMCZaiLDY5CGqsO4EvGHJK VK1OYbm3qSqi7Q==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:29 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/dict.scm (%dicod-gcide-index): New variable. (%dicod-database:gcide): Use it. (%dicod-activation): Remove. (dicod-shepherd-service): Remove reference to /var/run/dicod. (dicod-service-type): Remove ACTIVATION-SERVICE-TYPE extension. --- gnu/services/dict.scm | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index 7d48953ef1..f542921302 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -73,12 +73,24 @@ (define-record-type* (complex? dicod-database-complex? (default #f)) (options dicod-database-options (default '()))) +(define %dicod-gcide-index + ;; The GCIDE pre-built index. The Dico 'gcide' module can build it lazily; + ;; do it upfront so there's no need for a writable directory at run-time. + (computed-file "dicod-gcide-index" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (mkdir #$output) + (invoke #+(file-append dico "/libexec/idxgcide") + #+(file-append gcide "/share/gcide") + #$output))))) + (define %dicod-database:gcide (dicod-database (name "gcide") (handler "gcide") (options (list #~(string-append "dbdir=" #$gcide "/share/gcide") - "idxdir=/var/run/dicod")))) + #~(string-append "idxdir=" #$%dicod-gcide-index))))) (define %dicod-accounts (list (user-group @@ -137,14 +149,6 @@ (define (dicod-configuration-file config) (apply mixed-text-file "dicod.conf" (configuration->text config))) -(define %dicod-activation - #~(begin - (use-modules (guix build utils)) - (let ((user (getpwnam "dicod")) - (rundir "/var/run/dicod")) - (mkdir-p rundir) - (chown rundir (passwd:uid user) (passwd:gid user))))) - (define (dicod-shepherd-service config) (let* ((dicod.conf (dicod-configuration-file config)) (interfaces (dicod-configuration-interfaces config)) @@ -153,10 +157,6 @@ (define (dicod-shepherd-service config) "/bin/dicod") #:name "dicod" #:mappings (list (file-system-mapping - (source "/var/run/dicod") - (target source) - (writable? #t)) - (file-system-mapping (source "/dev/log") (target source)) (file-system-mapping @@ -187,8 +187,6 @@ (define dicod-service-type (extensions (list (service-extension account-service-type (const %dicod-accounts)) - (service-extension activation-service-type - (const %dicod-activation)) (service-extension shepherd-root-service-type dicod-shepherd-service))) (default-value (dicod-configuration)) From patchwork Sun Aug 6 21:07:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52597 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7932F27BBEA; Sun, 6 Aug 2023 22:08:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C822F27BBE2 for ; Sun, 6 Aug 2023 22:08:43 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkys-0006vY-4v; Sun, 06 Aug 2023 17:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyq-0006ua-KL for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkyq-0001T0-CO for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyq-0005id-6V for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 3/8] services: syncthing: Use 'match-record'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608121934 (code B ref 65119); Sun, 06 Aug 2023 21:08:04 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:01 +0000 Received: from localhost ([127.0.0.1]:60123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyn-0005hc-3Q for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyk-0005gk-5C for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkye-0001Lj-VZ; Sun, 06 Aug 2023 17:07:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=nDdToZxcfux/1RriOpjxjYDPb3Xi/MYRkq3pJUezDMc=; b=hG+oYRDwL/S23930QocJ UsPPusYrNftgepUPULAnBuWgYa4mdqlhjaaL2+7P7xHvkiO33Is2AB2JrIc82KZzBOz5ErMxRlZ1o 6Df1BQzlGJDJlxAU9UkmF1Wy7UPVMpF/oTIP3C0oPrhp4CSxbpob4E1vCM+swxUEeiZBkDb+/6iY/ v3YB43yWlpSmcRwHmg12tEnZqgQp8pL2A9Yo/ezhBtEZrZoSIWjYMBzascEKYW33l6qr3MLJQn/9Y l3ABSDbDOEs1E6EK8qeYSY3cTuJTdWsv9kUx49ky/se9joKd09eeYw7wZpFUp4dcolxis/TK5W5z7 FnD3jRKKHMr3Xg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:30 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/syncthing.scm (syncthing-shepherd-service): Use 'match-record-lambda' instead of 'match-lambda'. --- gnu/services/syncthing.scm | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm index 7c3d5b027d..8f94aef088 100644 --- a/gnu/services/syncthing.scm +++ b/gnu/services/syncthing.scm @@ -51,32 +51,32 @@ (define-record-type* (default #f))) (define syncthing-shepherd-service - (match-lambda - (($ syncthing arguments logflags user group home) - (list - (shepherd-service - (provision (list (string->symbol (string-append "syncthing-" user)))) - (documentation "Run syncthing.") - (requirement '(loopback)) - (start #~(make-forkexec-constructor - (append (list (string-append #$syncthing "/bin/syncthing") - "-no-browser" - "-no-restart" - (string-append "-logflags=" (number->string #$logflags))) - '#$arguments) - #:user #$user - #:group #$group - #:environment-variables - (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user)))) - "SSL_CERT_DIR=/etc/ssl/certs" - "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt") - (remove (lambda (str) - (or (string-prefix? "HOME=" str) - (string-prefix? "SSL_CERT_DIR=" str) - (string-prefix? "SSL_CERT_FILE=" str))) - (environ))))) - (respawn? #f) - (stop #~(make-kill-destructor))))))) + (match-record-lambda + (syncthing arguments logflags user group home) + (list + (shepherd-service + (provision (list (string->symbol (string-append "syncthing-" user)))) + (documentation "Run syncthing.") + (requirement '(loopback)) + (start #~(make-forkexec-constructor + (append (list (string-append #$syncthing "/bin/syncthing") + "-no-browser" + "-no-restart" + (string-append "-logflags=" (number->string #$logflags))) + '#$arguments) + #:user #$user + #:group #$group + #:environment-variables + (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user)))) + "SSL_CERT_DIR=/etc/ssl/certs" + "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt") + (remove (lambda (str) + (or (string-prefix? "HOME=" str) + (string-prefix? "SSL_CERT_DIR=" str) + (string-prefix? "SSL_CERT_FILE=" str))) + (environ))))) + (respawn? #f) + (stop #~(make-kill-destructor)))))) (define syncthing-service-type (service-type (name 'syncthing) From patchwork Sun Aug 6 21:07:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52593 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 46CEB27BBEA; Sun, 6 Aug 2023 22:08:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 224F627BBE2 for ; Sun, 6 Aug 2023 22:08:29 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkyt-0006vk-1E; Sun, 06 Aug 2023 17:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyr-0006v2-1B for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkyq-0001T6-Pd for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyq-0005ik-Ko for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 4/8] services: Define 'for-home'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608221951 (code B ref 65119); Sun, 06 Aug 2023 21:08:04 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:02 +0000 Received: from localhost ([127.0.0.1]:60125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyn-0005hi-EI for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyl-0005gm-0A for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyf-0001Ng-Qj; Sun, 06 Aug 2023 17:07:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=/Btq3TtWdV19hY1AtBQ5dUB+m9VRSrUjVIlM9vD5JuI=; b=K/EfFxnDnHlVLFwt4LzJ eEW7h/wVS1sep8voj0j0pz5I2NVwDtol2+EDHBvOnyGkG3YFtTX4DlRkGwEnryZZPnTK3Yff0bQuv UzOCP9g2Yu2UWQvLDTfBKD2ny0Wxgdr4cqbBhG7LaYTV53CqtTfbILpt2IYMULIHpi1dkDWdW9Zy2 AclULHn+oe4dyOCfj0v9vVOPxR9+20UwHsOn+dB0A7O5cVupgczoDenhEjlFT0hAXZznbu3BeCkYD tIxKvqBgLJQyBYRco7tJCG0Fq7GrCOfysV9yPFGNFL/kdw37ZSqo3MCXEfz3WSsuYWpYu+b73HJsb qSDfCcdmn3hqFw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:31 +0200 Message-ID: <55a8ef59696bd6f80da9e1bc5f8ca940df11eda6.1691355218.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services.scm (remove-service-extensions): New procedure. (for-home?): New syntax parameter. (for-home): New macro. --- gnu/services.scm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gnu/services.scm b/gnu/services.scm index 109e050a23..eb9258977e 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2022 Ludovic Courtès +;;; Copyright © 2015-2023 Ludovic Courtès ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020, 2021 Ricardo Wurmus @@ -86,6 +86,10 @@ (define-module (gnu services) instantiate-missing-services fold-services + remove-service-extensions + for-home + for-home? + service-error? missing-value-service-error? missing-value-service-error-type @@ -1225,4 +1229,23 @@ (define* (fold-services services (G_ "more than one target service of type '~a'") (service-type-name target-type))))))))) +(define (remove-service-extensions type lst) + "Return TYPE, a service type, without any of the service extensions +targeting one of the types in LST." + (service-type + (inherit type) + (extensions (remove (lambda (extension) + (memq (service-extension-target extension) lst)) + (service-type-extensions type))))) + +(define-syntax-parameter for-home? + ;; Whether the configuration being defined is for a Home service. + (identifier-syntax #f)) + +(define-syntax-rule (for-home exp ...) + "Mark EXP, which typically defines a service configuration, as targeting a +Home service rather than a System service." + (syntax-parameterize ((for-home? (identifier-syntax #t))) + exp ...)) + ;;; services.scm ends here. From patchwork Sun Aug 6 21:07:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52595 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8561C27BBE9; Sun, 6 Aug 2023 22:08:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5390427BBE2 for ; Sun, 6 Aug 2023 22:08:33 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkyt-0006vz-8L; Sun, 06 Aug 2023 17:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyr-0006vM-F1 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkyr-0001TD-77 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyr-0005is-2d for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 5/8] home: services: Support mapping of System services to Home services. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608321970 (code B ref 65119); Sun, 06 Aug 2023 21:08:05 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:03 +0000 Received: from localhost ([127.0.0.1]:60129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyo-0005i0-9R for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyl-0005go-Ps for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyg-0001PC-K1; Sun, 06 Aug 2023 17:07:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=p0zm6S+NSAKCFH6tPJFwFQZFE5R75Sv82JSMbkDEkg0=; b=ix3QbJUSs+FFupPilZd0 Tx3QRlU3QwY+YW+wsYjhq7R65mEE1PEB/nre7Oy/WrjiVpEAlHYovLCHg2iXfqjWtVcQM9pM5z5Or AiF1jh3CSc0NDFmh0EtPpmpSwSDy7ZGD4pdmH3/7WkA+3re/a4jQZgpDCcpybOcvxvs0YZxqokHRX GiSCn2bdS5KjBWtaagkrpQFpgOOK7AFHk4CJ6eBxqlsXJuel6Yo2klMCP5jvpzAEDmOlrv1yJNLly 7xkd7pJ+jEIkEVPEDuYCxLVpmMq42G/4R94x2wrRWxYaO7fbgEgyz0f3YHr1W0jJJQ6mipyKNfZzm mvw5jGjjgu8Dtw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:32 +0200 Message-ID: <2e33f4ce62f4238a147e1bac16302751efe69c26.1691355218.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services.scm (service-type-mapping) (system->home-service-type): New procedures. (define-service-type-mapping, define-service-type-mappings): New macros. (%system/home-service-type-mapping): New variable. : Use 'define-service-type-mappings'. * gnu/home/services/shepherd.scm : Likewise. --- gnu/home/services.scm | 69 +++++++++++++++++++++++++++++++++- gnu/home/services/shepherd.scm | 4 +- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 042eba4780..8d53f2f4d3 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -33,6 +33,7 @@ (define-module (gnu home services) #:use-module (guix diagnostics) #:use-module (guix i18n) #:use-module (guix modules) + #:use-module (guix memoization) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (ice-9 match) @@ -63,11 +64,16 @@ (define-module (gnu home services) lookup-home-service-types home-provenance + define-service-type-mapping + system->home-service-type + %initialize-gettext) #:re-export (service service-type - service-extension)) + service-extension + for-home + for-home?)) ;;; Comment: ;;; @@ -513,6 +519,67 @@ (define home-activation-service-type reconfiguration or generation switching. This service can be extended with one gexp, but many times, and all gexps must be idempotent."))) + +;;; +;;; Service type graph rewriting. +;;; + +(define (service-type-mapping proc) + "Return a procedure that applies PROC to map a service type graph to another +one." + (define (rewrite extension) + (match (proc (service-extension-target extension)) + (#f #f) + (target + (service-extension target + (service-extension-compute extension))))) + + (define replace + (mlambdaq (type) + (service-type + (inherit type) + (name (symbol-append 'home- (service-type-name type))) + (location (service-type-location type)) + (extensions (filter-map rewrite (service-type-extensions type)))))) + + replace) + +(define %system/home-service-type-mapping + ;; Mapping of System to Home services. + (make-hash-table)) + +(define system->home-service-type + ;; Map the given System service type to the corresponding Home service type. + (let () + (define (replace type) + (define replacement + (hashq-ref %system/home-service-type-mapping type + *unspecified*)) + + (if (eq? replacement *unspecified*) + type + replacement)) + + (service-type-mapping replace))) + +(define-syntax define-service-type-mapping + (syntax-rules (=>) + ((_ system-type => home-type) + (hashq-set! %system/home-service-type-mapping + system-type home-type)))) + +(define-syntax define-service-type-mappings + (syntax-rules (=>) + ((_ (system-type => home-type) ...) + (begin + (define-service-type-mapping system-type => home-type) + ...)))) + +(define-service-type-mappings + (system-service-type => home-service-type) + (activation-service-type => home-activation-service-type) + (profile-service-type => home-profile-service-type)) + ;;; ;;; On-change. diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index 5585ef61b2..bd068c37fc 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -141,7 +141,7 @@ (define (ensure-shepherd-gexp config) (define (shepherd-xdg-configuration-files config) `(("shepherd/init.scm" ,(home-shepherd-configuration-file config)))) -(define-public home-shepherd-service-type +(define home-shepherd-service-type (service-type (name 'home-shepherd) (extensions (list (service-extension @@ -168,4 +168,6 @@ (define-public home-shepherd-service-type (default-value (home-shepherd-configuration)) (description "Configure and install userland Shepherd."))) +(define-service-type-mapping + shepherd-root-service-type => home-shepherd-service-type) From patchwork Sun Aug 6 21:07:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52598 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2C48927BBE9; Sun, 6 Aug 2023 22:09:07 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5B77027BBE2 for ; Sun, 6 Aug 2023 22:09:04 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkzm-0007Jk-Mc; Sun, 06 Aug 2023 17:09:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkzm-0007JY-2V for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkzl-0001XS-Qj for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkzl-0005kb-Kp for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 6/8] home: services: mcron: Define as a mapping of the system service. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608722026 (code B ref 65119); Sun, 06 Aug 2023 21:09:01 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:07 +0000 Received: from localhost ([127.0.0.1]:60138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkys-0005jA-E5 for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkym-0005gp-Jv for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyh-0001Qc-Dz; Sun, 06 Aug 2023 17:07:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ETOIUMrTkUZoCm7DeL/5iMayIzi3BLCgHYt6kxTyd5c=; b=BbHatuEglK5X3xGJ8rYV +/GBonmx7IY5v+J80dE67mtN+a2hj8S+8rx4zGOFi66Xp0yNoxFsLSu2RLux1Yvwanw+beXOOKu8o ewcg5m3lmDw6ZxUMtDaunMcJr6pl/oCqv/UoE4/3E2iusGxjGwf8wqbRxotEOtDvrkNiGF7M7vGf8 A2IXwqMSLQ3w2SySZoBQcLECSBObNl+lsbNut8UEhUecjFXw9nSc3MecEZ9NVzfmU4e8ab1xv6BcS q955PHdfTg+vLAb9ZVdNVsoJIO1qzw9SPZcpwG/0RqNUnG2yrjH2nOxBkDti7TOh7asxQaWq7OMLH WwDxEkj5sJUwhA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:33 +0200 Message-ID: <319a7664fdf2b910f4183ce3c748234a8763e107.1691355218.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/mcron.scm (list-of-gexps?): Remove. (): Rewrite using 'define-record-type*'. [home-service?]: New field. [log-file]: Make thunked and changed default value. (mcron-shepherd-services): Honor 'home-service?' and remove use of 'maybe-value-set?'. (mcron-service-type): Inherit 'home-service?' from CONFIG. (generate-doc): Remove. * gnu/home/services/mcron.scm (list-of-gexp?) (, job-files, shepherd-schedule-action) (home-mcron-shepherd-services, home-mcron-profile) (home-mcron-extend, generate-doc): Remove. (home-mcron-configuration): Turn into a macro. (home-mcron-service-type): Define in terms of 'system->home-service-type'. : Add service type mapping. --- gnu/home/services/mcron.scm | 96 ++++--------------------------------- gnu/services/mcron.scm | 80 ++++++++++++++----------------- 2 files changed, 45 insertions(+), 131 deletions(-) diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm index f51edd6634..23be44ba07 100644 --- a/gnu/home/services/mcron.scm +++ b/gnu/home/services/mcron.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021, 2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2023 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,16 +20,9 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu home services mcron) - #:use-module (gnu packages guile-xyz) #:use-module (gnu home services) - #:use-module (gnu services configuration) - #:use-module (gnu services shepherd) #:use-module (gnu home services shepherd) - #:use-module (guix records) - #:use-module (guix gexp) - #:use-module (srfi srfi-1) - #:use-module (ice-9 match) - + #:use-module (gnu services mcron) ;for the service mapping #:export (home-mcron-configuration home-mcron-service-type)) @@ -55,86 +49,16 @@ (define-module (gnu home services mcron) ;; ;;; Code: -(define list-of-gexps? - (list-of gexp?)) - -(define-configuration/no-serialization home-mcron-configuration - (mcron (file-like mcron) "The mcron package to use.") - (jobs - (list-of-gexps '()) - "This is a list of gexps (@pxref{G-Expressions}), where each gexp -corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}).") - (log? (boolean #t) "Log messages to standard output.") - (log-format - (string "~1@*~a ~a: ~a~%") - "@code{(ice-9 format)} format string for log messages. The default value -produces messages like \"@samp{@var{pid} @var{name}: -@var{message}\"} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). -Each message is also prefixed by a timestamp by GNU Shepherd.")) - -(define job-files (@@ (gnu services mcron) job-files)) -(define shepherd-schedule-action - (@@ (gnu services mcron) shepherd-schedule-action)) - -(define (home-mcron-shepherd-services config) - (match-record config - (mcron jobs log? log-format) - (if (null? jobs) - '() ;no jobs to run - (let ((files (job-files mcron jobs))) - (list (shepherd-service - (documentation "User cron jobs.") - (provision '(mcron)) - (modules `((srfi srfi-1) - (srfi srfi-26) - (ice-9 popen) ;for the 'schedule' action - (ice-9 rdelim) - (ice-9 match) - ,@%default-modules)) - (start #~(make-forkexec-constructor - (list (string-append #$mcron "/bin/mcron") - #$@(if log? - #~("--log" "--log-format" #$log-format) - #~()) - #$@files) - #:log-file (string-append - (or (getenv "XDG_STATE_HOME") - (format #f "~a/.local/state" - (getenv "HOME"))) - "/log/mcron.log"))) - (stop #~(make-kill-destructor)) - (actions - (list (shepherd-schedule-action mcron files))))))))) - -(define home-mcron-profile (compose list home-mcron-configuration-mcron)) - -(define (home-mcron-extend config jobs) - (home-mcron-configuration - (inherit config) - (jobs (append (home-mcron-configuration-jobs config) - jobs)))) +(define-syntax-rule (home-mcron-configuration fields ...) + ;; Macro provided for backward compatibility. + (for-home (mcron-configuration fields ...))) (define home-mcron-service-type - (service-type (name 'home-mcron) - (extensions - (list (service-extension - home-shepherd-service-type - home-mcron-shepherd-services) - (service-extension - home-profile-service-type - home-mcron-profile))) - (compose concatenate) - (extend home-mcron-extend) - (default-value (home-mcron-configuration)) - (description - "Install and configure the GNU mcron cron job manager."))) + (service-type + (inherit (system->home-service-type mcron-service-type)) + (default-value (for-home (mcron-configuration))))) - -;;; -;;; Generate documentation. -;;; -(define (generate-doc) - (configuration->documentation 'home-mcron-configuration)) +(define-service-type-mapping + mcron-service-type => home-mcron-service-type) ;;; mcron.scm ends here diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 2ef5980e09..db8b539ff5 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2016-2020, 2023 Ludovic Courtès ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Bruno Victal ;;; @@ -20,10 +20,8 @@ (define-module (gnu services mcron) #:use-module (gnu services) - #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu packages guile-xyz) - #:use-module (guix deprecation) #:use-module (guix records) #:use-module (guix gexp) #:use-module (srfi srfi-1) @@ -37,6 +35,7 @@ (define-module (gnu services mcron) mcron-configuration-log-file mcron-configuration-log-format mcron-configuration-date-format + mcron-configuration-home-service? mcron-service-type)) @@ -55,40 +54,34 @@ (define-module (gnu services mcron) ;;; ;;; Code: -(define list-of-gexps? - (list-of gexp?)) +;; Configuration of mcron. +;; XXX: 'define-configuration' cannot be used here due to the need for +;; 'thunked' and 'innate' fields as well as 'this-mcron-configuration'. +(define-record-type* mcron-configuration + make-mcron-configuration + mcron-configuration? + this-mcron-configuration -(define-maybe/no-serialization string) + (mcron mcron-configuration-mcron ;file-like + (default mcron)) + (jobs mcron-configuration-jobs ;list of gexps + (default '())) + (log? mcron-configuration-log? ;Boolean + (default #t)) + (log-file mcron-configuration-log-file ;string | gexp + (thunked) + (default + (if (mcron-configuration-home-service? + this-mcron-configuration) + #~(string-append %user-log-dir "/mcron.log") + "/var/log/mcron.log"))) + (log-format mcron-configuration-log-format ;string + (default "~1@*~a ~a: ~a~%")) + (date-format mcron-configuration-date-format ;string | #f + (default #f)) -(define-configuration/no-serialization mcron-configuration - (mcron - (file-like mcron) - "The mcron package to use.") - - (jobs - (list-of-gexps '()) - "This is a list of gexps (@pxref{G-Expressions}), where each gexp -corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}).") - - (log? - (boolean #t) - "Log messages to standard output.") - - (log-file - (string "/var/log/mcron.log") - "Log file location.") - - (log-format - (string "~1@*~a ~a: ~a~%") - "@code{(ice-9 format)} format string for log messages. The default value -produces messages like @samp{@var{pid} @var{name}: @var{message}} -(@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). -Each message is also prefixed by a timestamp by GNU Shepherd.") - - (date-format - maybe-string - "@code{(srfi srfi-19)} format string for date.")) + (home-service? mcron-configuration-home-service? + (default for-home?) (innate))) (define (job-files mcron jobs) "Return a list of file-like object for JOBS, a list of gexps." @@ -158,13 +151,15 @@ (define (shepherd-schedule-action mcron files) (define (mcron-shepherd-services config) (match-record config - (mcron jobs log? log-file log-format date-format) + (mcron jobs log? log-file log-format date-format home-service?) (if (eq? jobs '()) '() ;nothing to do (let ((files (job-files mcron jobs))) (list (shepherd-service (provision '(mcron)) - (requirement '(user-processes)) + (requirement (if home-service? + '() + '(user-processes))) (modules `((srfi srfi-1) (srfi srfi-26) (ice-9 popen) ;for the 'schedule' action @@ -175,7 +170,7 @@ (define (mcron-shepherd-services config) (list #$(file-append mcron "/bin/mcron") #$@(if log? `("--log" "--log-format" ,log-format - ,@(if (maybe-value-set? date-format) + ,@(if date-format (list "--date-format" date-format) '())) @@ -209,15 +204,10 @@ (define mcron-service-type (extend (lambda (config jobs) (mcron-configuration (inherit config) + (home-service? + (mcron-configuration-home-service? config)) (jobs (append (mcron-configuration-jobs config) jobs))))) (default-value (mcron-configuration)))) ;empty job list - -;;; -;;; Generate documentation. -;;; -(define (generate-doc) - (configuration->documentation 'mcron-configuration)) - ;;; mcron.scm ends here From patchwork Sun Aug 6 21:07:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52600 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 47D0227BBE2; Sun, 6 Aug 2023 22:09:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DB71227BBE9 for ; Sun, 6 Aug 2023 22:09:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkzn-0007Kj-V2; Sun, 06 Aug 2023 17:09:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkzm-0007Jg-GG for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkzm-0001XY-7B for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkzm-0005kj-36 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 7/8] home: services: Add dicod. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608822033 (code B ref 65119); Sun, 06 Aug 2023 21:09:02 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:08 +0000 Received: from localhost ([127.0.0.1]:60140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyt-0005jD-8g for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyn-0005gr-Ft for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyi-0001Qp-9F; Sun, 06 Aug 2023 17:07:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=c4P7TVcuWDK2DdSQqQmIsugTYHnFhBfLGlX+tQFE3E4=; b=SrwvsIS/PF9II1K1hE9Z qQg9iipF4AN/GP0hvnINFDZiwlhiPUGLCLbCFgyriw+O03cX6NGeU3xyTQybNXcmk8+NeXUvZ3yNq P5JqlDZjjOT3EVLyZoGj+7D1ELed0/qhjhgpOsqkRFt81feRBGKObcevjiMAr6WYVrQK1XjU7Eyt8 gWxVUF1yTPhluzvePTuob1GYemshARLEwYXoE7UfjRxm+JfQ/yn9ZT0M1cp61SQym0tRStxmi6SUb gYHTLFXV4UDOIHOVBrtvGWsXKA4R+3kXFW2IHXjRM2iJZ4ZGyqmqoqzvN8oM1e/6a3jmV9ZRpk69k 5ANwXJzfomAOfA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:34 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/dict.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/services/dict.scm ()[home-service?]: New field. (dicod-shepherd-service): Do not map /dev/log when 'home-service?' is true. Remove 'user-processes' requirement when 'home-service?' is true. (dicod-shepherd-service): Set #:user and #:group to #f when 'home-service?' is true. * doc/guix.texi (Miscellaneous Home Services): New node. (Miscellaneous Services): Add cross-reference. --- doc/guix.texi | 45 ++++++++++++++++++++++++++++++++++++++ gnu/home/services/dict.scm | 32 +++++++++++++++++++++++++++ gnu/local.mk | 1 + gnu/services/dict.scm | 27 +++++++++++++++-------- 4 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 gnu/home/services/dict.scm diff --git a/doc/guix.texi b/doc/guix.texi index 1d8ebcd72f..dd272636a3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -446,6 +446,7 @@ Top * Mail: Mail Home Services. Services for managing mail. * Messaging: Messaging Home Services. Services for managing messaging. * Media: Media Home Services. Services for managing media. +* Miscellaneous: Miscellaneous Home Services. More services. Platforms @@ -38723,6 +38724,12 @@ Miscellaneous Services You can add @command{open localhost} to your @file{~/.dico} file to make @code{localhost} the default server for @command{dico} client (@pxref{Initialization File,,, dico, GNU Dico Manual}). + +@quotation Note +This service is also available for Guix Home, where it runs directly +with your user privileges (@pxref{Miscellaneous Home Services, +@code{home-dicod-service-type}}). +@end quotation @end defvar @deftp {Data Type} dicod-configuration @@ -42613,6 +42620,7 @@ Home Services * Mail: Mail Home Services. Services for managing mail. * Messaging: Messaging Home Services. Services for managing messaging. * Media: Media Home Services. Services for managing media. +* Miscellaneous: Miscellaneous Home Services. More services. @end menu @c In addition to that Home Services can provide @@ -44202,6 +44210,43 @@ Media Home Services @end table @end deftp +@node Miscellaneous Home Services +@subsection Miscellaneous Home Services + +This section lists Home services that lack a better place. + +@subsubheading Dictionary Service + +@cindex dictionary service, for Home +The @code{(gnu home services dict)} module provides the following service: + +@defvar home-dicod-service-type +This is the type of the service that runs the @command{dicod} daemon, an +implementation of DICT server (@pxref{Dicod,,, dico, GNU Dico Manual}). + +You can add @command{open localhost} to your @file{~/.dico} file to make +@code{localhost} the default server for @command{dico} client +(@pxref{Initialization File,,, dico, GNU Dico Manual}). +@end defvar + +This service is a direct mapping of the @code{dicod-service-type} system +service (@pxref{Miscellaneous Services, Dictionary Service}). You can +use it like this: + +@lisp +(service home-dicod-service-type) +@end lisp + +You may specify a custom configuration by providing a +@code{dicod-configuration} record, exactly like for +@code{dicod-service-type}, but wrapping it in @code{for-home}: + +@lisp +(service home-dicod-service-type + (for-home + (dicod-configuration @dots{}))) +@end lisp + @node Invoking guix home @section Invoking @command{guix home} diff --git a/gnu/home/services/dict.scm b/gnu/home/services/dict.scm new file mode 100644 index 0000000000..b8a4653276 --- /dev/null +++ b/gnu/home/services/dict.scm @@ -0,0 +1,32 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu home services dict) + #:use-module (gnu home services) + #:use-module (gnu services) + #:use-module (gnu services dict) + #:use-module ((gnu system shadow) #:select (account-service-type)) + #:export (home-dicod-service-type) + #:re-export (dicod-configuration)) + +(define home-dicod-service-type + (service-type + (inherit (system->home-service-type + (remove-service-extensions dicod-service-type + (list account-service-type)))) + (default-value (for-home (dicod-configuration))))) diff --git a/gnu/local.mk b/gnu/local.mk index f10713f126..b496b53a97 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -91,6 +91,7 @@ GNU_SYSTEM_MODULES = \ %D%/home.scm \ %D%/home/services.scm \ %D%/home/services/desktop.scm \ + %D%/home/services/dict.scm \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ %D%/home/services/gnupg.scm \ diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index f542921302..a4e25f5302 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -56,7 +56,9 @@ (define-record-type* (handlers dicod-configuration-handlers ;list of (default '())) (databases dicod-configuration-databases ;list of - (default (list %dicod-database:gcide)))) + (default (list %dicod-database:gcide))) + (home-service? dicod-configuration-home-service? ;boolean + (default for-home?) (innate))) (define-record-type* dicod-handler make-dicod-handler @@ -152,20 +154,26 @@ (define (dicod-configuration-file config) (define (dicod-shepherd-service config) (let* ((dicod.conf (dicod-configuration-file config)) (interfaces (dicod-configuration-interfaces config)) + (home-service? (dicod-configuration-home-service? config)) + (mappings `(,@(if home-service? + '() + (list (file-system-mapping + (source "/dev/log") + (target source)))) + ,(file-system-mapping + (source dicod.conf) + (target source)))) (dicod (least-authority-wrapper (file-append (dicod-configuration-dico config) "/bin/dicod") #:name "dicod" - #:mappings (list (file-system-mapping - (source "/dev/log") - (target source)) - (file-system-mapping - (source dicod.conf) - (target source))) + #:mappings mappings #:namespaces (delq 'net %namespaces)))) (list (shepherd-service (provision '(dicod)) - (requirement '(user-processes)) + (requirement (if home-service? + '() + '(user-processes))) (documentation "Run the dicod daemon.") (start #~(make-inetd-constructor (list #$dicod "--inetd" "--foreground" @@ -176,7 +184,8 @@ (define (dicod-shepherd-service config) (car (getaddrinfo interface "dict"))))) '#$interfaces) #:requirements '#$requirement - #:user "dicod" #:group "dicod" + #:user #$(and (not home-service?) "dicod") + #:group #$(and (not home-service?) "dicod") #:service-name-stem "dicod")) (stop #~(make-inetd-destructor)) (actions (list (shepherd-configuration-action dicod.conf))))))) From patchwork Sun Aug 6 21:07:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 52599 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 55BF927BBEA; Sun, 6 Aug 2023 22:09:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DF9CA27BBE2 for ; Sun, 6 Aug 2023 22:09:20 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkzo-0007L4-Gb; Sun, 06 Aug 2023 17:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkzm-0007Jr-TW for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSkzm-0001Yy-LD for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkzm-0005kq-Ge for guix-patches@gnu.org; Sun, 06 Aug 2023 17:09:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 8/8] home: services: Add Syncthing. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608822040 (code B ref 65119); Sun, 06 Aug 2023 21:09:02 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:08 +0000 Received: from localhost ([127.0.0.1]:60142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyt-0005jK-Vq for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyo-0005gt-A1 for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSkyj-0001Qw-4E; Sun, 06 Aug 2023 17:07:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=PRWEc0ELfnr0sixGrxe0jZ+hbTqDRGNBJzcGfGpP1N8=; b=lUSgWnMdn/Bma0wZKSGo Fi7yH4xY1hknjb3kI790YFZy3Ng1qajU+K857/DrN9WymXl7sgKuAmV5Jvf7KlxsebEYhF0KiyzFr GCXvu1zKlVARX94dTZJ6gAJyydw0GQdi0haG2YuNSxQC/s50qbVanchc6FVU8N2a2zW7pCw6dcmkH S/OBGHkElJBlUQ0T3uzSmMieYTcJLO+uyIxSlmKZVBXUg8Cxvzayw8S+G+nwQhGbE8blrSBblPAwi Bxzo14kwazZ1rXEFQ/bCEdfYUyx06NhqBjnRAAMbmfRAyHFOsF3qAch3IsgeAPScjEI8LzfxZhbgm 7+EsWjqE6wmFHA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:35 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/syncthing.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/services/syncthing.scm ()[home-service?]: New field. Adjust 'provision' and 'requirement' depending on 'home-service?', and likewise for #:user and #:group. Use 'filter' + 'negate' instead of 'remove'. * doc/guix.texi (Networking Services): Add note and cross-reference to "Networking Home Services". (Networking Home Services): New node. --- doc/guix.texi | 51 ++++++++++++++++++++++++++++++++- gnu/home/services/syncthing.scm | 30 +++++++++++++++++++ gnu/local.mk | 1 + gnu/services/syncthing.scm | 26 ++++++++++------- 4 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 gnu/home/services/syncthing.scm diff --git a/doc/guix.texi b/doc/guix.texi index dd272636a3..a4993b7ae7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -446,6 +446,7 @@ Top * Mail: Mail Home Services. Services for managing mail. * Messaging: Messaging Home Services. Services for managing messaging. * Media: Media Home Services. Services for managing media. +* Networking: Networking Home Services. Networking services. * Miscellaneous: Miscellaneous Home Services. More services. Platforms @@ -21226,6 +21227,8 @@ Networking Services @end table @end deftp +@cindex Syncthing, file synchronization service +@cindex backup service, Syncthing The @code{(gnu services syncthing)} module provides the following services: @cindex syncthing @@ -21243,7 +21246,14 @@ Networking Services (syncthing-configuration (user "alice"))) @end lisp +@quotation Note +This service is also available for Guix Home, where it runs directly +with your user privileges (@pxref{Networking Home Services, +@code{home-syncthing-service-type}}). +@end quotation + See below for details about @code{syncthing-configuration}. +@end defvar @deftp {Data Type} syncthing-configuration Data type representing the configuration for @code{syncthing-service-type}. @@ -21273,7 +21283,6 @@ Networking Services @end table @end deftp -@end defvar Furthermore, @code{(gnu services ssh)} provides the following services. @cindex SSH @@ -42620,6 +42629,7 @@ Home Services * Mail: Mail Home Services. Services for managing mail. * Messaging: Messaging Home Services. Services for managing messaging. * Media: Media Home Services. Services for managing media. +* Networking: Networking Home Services. Networking services. * Miscellaneous: Miscellaneous Home Services. More services. @end menu @c In addition to that Home Services can provide @@ -44210,6 +44220,45 @@ Media Home Services @end table @end deftp +@node Networking Home Services +@subsection Networking Home Services + +This section lists services somewhat networking-related that you may use +with Guix Home. + +@cindex Syncthing, file synchronization service +@cindex backup service, Syncthing +The @code{(gnu home services syncthing)} module provides a service to +set up the @uref{Syncthing, https://syncthing.net} continuous file +backup service. + +@defvar home-syncthing-service-type +This is the service type for the @command{syncthing} daemon; it is the +Home counterpart of the @code{syncthing-service-type} system service +(@pxref{Networking Services, @code{syncthing-service-type}}). The value +for this service type is a @command{syncthing-configuration}. + +Here is how you would set it up with the default configuration: + +@lisp +(service home-syncthing-service-type) +@end lisp + +For a custom configuration, wrap you @code{syncthing-configuration} in +@code{for-home}, as in this example: + +@lisp +(service home-syncthing-service-type + (for-home + (syncthing-configuration (logflags 5)))) +@end lisp + +For details about @code{syncthing-configuration}, check out the +documentation of the system service (@pxref{Networking Services, +@code{syncthing-service-type}}). +@end defvar + + @node Miscellaneous Home Services @subsection Miscellaneous Home Services diff --git a/gnu/home/services/syncthing.scm b/gnu/home/services/syncthing.scm new file mode 100644 index 0000000000..9c9eb94ea1 --- /dev/null +++ b/gnu/home/services/syncthing.scm @@ -0,0 +1,30 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu home services syncthing) + #:use-module (gnu services) + #:use-module (gnu home services) + #:use-module (gnu services syncthing) + #:export (home-syncthing-service-type) + #:re-export (syncthing-configuration + syncthing-configuration?)) + +(define home-syncthing-service-type + (service-type + (inherit (system->home-service-type syncthing-service-type)) + (default-value (for-home (syncthing-configuration))))) diff --git a/gnu/local.mk b/gnu/local.mk index b496b53a97..d98ecfb7b4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -104,6 +104,7 @@ GNU_SYSTEM_MODULES = \ %D%/home/services/shepherd.scm \ %D%/home/services/sound.scm \ %D%/home/services/ssh.scm \ + %D%/home/services/syncthing.scm \ %D%/home/services/mcron.scm \ %D%/home/services/utils.scm \ %D%/home/services/xdg.scm \ diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm index 8f94aef088..f97a1a2ff4 100644 --- a/gnu/services/syncthing.scm +++ b/gnu/services/syncthing.scm @@ -48,32 +48,38 @@ (define-record-type* (group syncthing-configuration-group ;string (default "users")) (home syncthing-configuration-home ;string - (default #f))) + (default #f)) + (home-service? syncthing-configuration-home-service? + (default for-home?) (innate))) (define syncthing-shepherd-service (match-record-lambda - (syncthing arguments logflags user group home) + (syncthing arguments logflags user group home home-service?) (list (shepherd-service - (provision (list (string->symbol (string-append "syncthing-" user)))) + (provision (if home-service? + '(syncthing) + (list (string->symbol + (string-append "syncthing-" user))))) (documentation "Run syncthing.") - (requirement '(loopback)) + (requirement (if home-service? '() '(loopback))) (start #~(make-forkexec-constructor (append (list (string-append #$syncthing "/bin/syncthing") "-no-browser" "-no-restart" (string-append "-logflags=" (number->string #$logflags))) '#$arguments) - #:user #$user - #:group #$group + #:user #$(and (not home-service?) user) + #:group #$(and (not home-service?) group) #:environment-variables (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user)))) "SSL_CERT_DIR=/etc/ssl/certs" "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt") - (remove (lambda (str) - (or (string-prefix? "HOME=" str) - (string-prefix? "SSL_CERT_DIR=" str) - (string-prefix? "SSL_CERT_FILE=" str))) + (filter (negate ;XXX: 'remove' is not in (guile) + (lambda (str) + (or (string-prefix? "HOME=" str) + (string-prefix? "SSL_CERT_DIR=" str) + (string-prefix? "SSL_CERT_FILE=" str)))) (environ))))) (respawn? #f) (stop #~(make-kill-destructor))))))