From unknown Sun Jun 22 11:41:15 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#71664] [PATCH v2 4/5] services: backup: Move restic package to restic-configuration Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 20 Jun 2024 03:46:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71664 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71664@debbugs.gnu.org, 71639@debbugs.gnu.org Cc: Richard Sent , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org, 71639@debbugs.gnu.org X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by submit@debbugs.gnu.org id=B.171885514125213 (code B ref -1); Thu, 20 Jun 2024 03:46:04 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jun 2024 03:45:41 +0000 Received: from localhost ([127.0.0.1]:41539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8k0-0006YN-Ve for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:39468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8jy-0006Y6-SB for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:40 -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 1sK8jv-0006l2-00 for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:35 -0400 Received: from mail-108-mta167.mxroute.com ([136.175.108.167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sK8jm-0007F1-0s for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:27 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta167.mxroute.com (ZoneMTA) with ESMTPSA id 19033bfbb8000017a3.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 03:45:21 +0000 X-Zone-Loop: 9025d32764e1ffd5e18579c464541c62cbbf65d5392e X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vlt6rUXjCF1movO1Sh+fPT/u7XuM91FUt1+2ianbH9o=; b=QKo4caAd2qnZdEsa/ahHUEpPlD ViOhlUKrTkLNK62vYm8hHvaNswp6rii+CCmLNqcPxlYZPZ/KtKmgHPvx11Pv+8jygmonNf6pUMibv 2CLgQH04SDG9S+joknahdk8IzZPt5B4j5ZxkmCEJK5WfqZnuiEMvsheQnzAL/ITi5KL4tbSLmo2Fm qFChcnAOAVpLIhkGtXSapv2TB7x2IceF60xl3TVQWdObXv75caBaW2l/vkRET/CgwHeB70KZ+/Y8k JG4P6Ru0dBfAEhyVhNd4gvfIN9OyqAzxuLgwrgMdhOAvcq1kgqKb7WXj+jo7frQnI1jrnfHiZV3mb BgIEasug==; From: Richard Sent Date: Wed, 19 Jun 2024 23:44:15 -0400 Message-ID: <56345eb5926246798f52424883caa3fd0e88cee8.1718854920.git.richard@freakingpenguin.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.167; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta167.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/services/backup.scm (restic-backup-configuration): Add restic field. (restic-backup-job-program): Add restic package to function signature. (restic-guix): Ditto. (restic-guix-wrapper-package): Ditto. Add restic package as package input. (restic-backup-service-profile): Remove excess lamba. * doc/guix.texi (Miscellaneous Services): Document it. Change-Id: I1e5f63c21cd072354225afe0ee270dca8d9d840b --- doc/guix.texi | 6 +++--- gnu/services/backup.scm | 38 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 32ce0c86b9..e4379c5e1c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41311,6 +41311,9 @@ Miscellaneous Services Available @code{restic-backup-configuration} fields are: @table @asis +@item @code{restic} (default: @code{restic}) (type: package) +The restic package to use for all jobs. + @item @code{jobs} (default: @code{'()}) (type: list-of-restic-backup-jobs) The list of backup jobs for the current system. @@ -41327,9 +41330,6 @@ Miscellaneous Services Available @code{restic-backup-job} fields are: @table @asis -@item @code{restic} (default: @code{restic}) (type: package) -The restic package to be used for the current job. - @item @code{user} (default: @code{"root"}) (type: string) The user used for running the current job. diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index bfbacfe590..5e2add088e 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -29,10 +29,10 @@ (define-module (gnu services backup) #:use-module (guix modules) #:use-module (guix packages) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:export (restic-backup-job restic-backup-job? restic-backup-job-fields - restic-backup-job-restic restic-backup-job-user restic-backup-job-name restic-backup-job-repository @@ -46,6 +46,7 @@ (define-module (gnu services backup) restic-backup-configuration restic-backup-configuration? + restic-backup-configuration-restic restic-backup-configuration-fields restic-backup-configuration-jobs @@ -71,9 +72,6 @@ (define-maybe/no-serialization string) (define-maybe/no-serialization file-like) (define-configuration/no-serialization restic-backup-job - (restic - (package restic) - "The restic package to be used for the current job.") (user (string "root") "The user used for running the current job.") @@ -129,11 +127,14 @@ (define list-of-restic-backup-jobs? (list-of restic-backup-job?)) (define-configuration/no-serialization restic-backup-configuration + (restic + (package restic) + "The restic package to be used.") (jobs (list-of-restic-backup-jobs '()) "The list of backup jobs for the current system.")) -(define (restic-backup-job-program config) +(define (restic-backup-job-program restic-package config) (define (maybe-value-or-false maybe) (if (maybe-value-set? maybe) maybe @@ -142,7 +143,7 @@ (define (restic-backup-job-program config) (verify-restic-backup-job-configuration config) (let ((restic - (file-append (restic-backup-job-restic config) "/bin/restic")) + (file-append restic-package "/bin/restic")) (repository (restic-backup-job-repository config)) (password-file @@ -189,7 +190,7 @@ (define (restic-backup-job-program config) #$@extra-flags "backup" #$@files))))) -(define (restic-guix jobs) +(define (restic-guix restic-package jobs) (program-file "restic-guix" #~(begin @@ -197,7 +198,7 @@ (define (restic-guix jobs) (srfi srfi-1)) (define names '#$(map restic-backup-job-name jobs)) - (define programs '#$(map restic-backup-job-program jobs)) + (define programs '#$(map (cut restic-backup-job-program restic-package <>) jobs)) (define (get-program name) (define idx @@ -240,13 +241,13 @@ (define (restic-backup-job->mcron-job config) #$(string-append "restic-guix backup " name) #:user #$user))) -(define (restic-guix-wrapper-package jobs) +(define (restic-guix-wrapper-package restic jobs) (let ((extra-packages (append-map restic-backup-job-extra-packages jobs))) (package (name "restic-backup-service-wrapper") (version "0.0.0") - (source (restic-guix restic-package jobs)) + (source (restic-guix restic jobs)) (build-system copy-build-system) (arguments (list #:install-plan #~'(("./" "/bin")))) @@ -258,16 +259,17 @@ (define (restic-guix-wrapper-package jobs) by the @code{restic-backup-service-type}. It allows for easily interacting with Guix configured backup jobs, for example for manually triggering a backup without waiting for the scheduled job to run.") - (inputs extra-packages) + (inputs (cons restic extra-packages)) (license license:gpl3+)))) -(define restic-backup-service-profile - (lambda (config) - (define jobs (restic-backup-configuration-jobs config)) - (if (> (length jobs) 0) - (list - (restic-guix-wrapper-package jobs)) - '()))) +(define (restic-backup-service-profile config) + (let ((jobs (restic-backup-configuration-jobs config)) + (restic (restic-backup-configuration-restic config))) + ;; Even if we provide a wrapper we need to add restic to the profile so + ;; the service works in containers and VMs which only see a subset of + ;; /gnu/store. https://issues.guix.gnu.org/70553. Ergo pass restic to + ;; the wrapper package so it is added as an input. + (list (restic-guix-wrapper-package restic jobs)))) (define restic-backup-service-type (service-type (name 'restic-backup) -- 2.45.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 20 16:58:43 2024 Received: (at control) by debbugs.gnu.org; 20 Jun 2024 20:58:43 +0000 Received: from localhost ([127.0.0.1]:43946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKOrj-0004ZJ-BL for submit@debbugs.gnu.org; Thu, 20 Jun 2024 16:58:43 -0400 Received: from mail-108-mta104.mxroute.com ([136.175.108.104]:35435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKOrg-0004Z3-1e for control@debbugs.gnu.org; Thu, 20 Jun 2024 16:58:41 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta104.mxroute.com (ZoneMTA) with ESMTPSA id 1903771a2d900017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 20:58:32 +0000 X-Zone-Loop: a50181b858085bee4720e0de685656af22bcefc2974a X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Subject:From:To:Message-Id:Date:Sender:Reply-To :Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+uasS73KDkaVy9m1dARo1g/bv+uld7j/bS3gpjn9HFg=; b=G80gHQZCXw83Mb3EWHQNJQ64L8 aQOUsYS86v9fMO6UhGDKp88si7LKXQWiUTu93geLR/LTOgkMphdoopUQ1Rk8GUVld3ULUDdoRzgMS qYgghhmAnOz7f9d3vXdZ9iWB0EyvwU04cmiks8Ep8O2bEPptOCWeWhZoAYHzldjgA+JkB6UEb7FPh vU7crAqkUeaj/UTUkt0ExOBHJeIUEow7Fimh+TZjigdm1IHo26WO5o179N/WCLKwIhO9RM4l+ORcp +1JNzLxynQG0EkQ6sbGP1G0u5lPuk0J89P3Idz2hRjbhW/v1CjNoTOdJ3Ftyl8lUz9/2f44poQrKe Pv2Mp0cA==; Date: Thu, 20 Jun 2024 16:58:28 -0400 Message-Id: <878qyzqqkr.fsf@freakingpenguin.com> To: control@debbugs.gnu.org From: Richard Sent Subject: control message for bug #71664 X-Authenticated-Id: richard@freakingpenguin.com X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 71664 quit