From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 4ATKHiCmc2YSHwAAe85BDQ:P1 (envelope-from ) for ; Thu, 20 Jun 2024 03:46:40 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 4ATKHiCmc2YSHwAAe85BDQ (envelope-from ) for ; Thu, 20 Jun 2024 05:46:40 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=QKo4caAd; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718855200; a=rsa-sha256; cv=none; b=MtQXQo5QqRAJzccEkP4AOpas+uepYLJhdkQOaB9ih2mT98cgc6eyClJm5zoqiZRYn5BpJe a1vtwQJ/sSvo4/rc8U8w2ex2fD+6BE0uAT3XtlUjF8Ms8BGO2e9FxgtvOVdHcW998xTPsM n1ZB1WI/H/n12uXZ03CRTDYtKb1+/l3HXK5PvYbWsYAx1hQw7fCGFKSebI3zJNoopA22i8 hbH8TruKNPcwKk4tq2pQMnSCTiWmlfcSGpy4bKs9s7s2U4ECr8miQof6UqF2pXRI09AoD/ HQVQ02FLGtP6295P0SwSDtlwjAlVwixZjVw5GPuEdkplnuRhJyE/sSnQGl0EsQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=QKo4caAd; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718855200; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Vlt6rUXjCF1movO1Sh+fPT/u7XuM91FUt1+2ianbH9o=; b=HC9+bioIoQZvRJfEUggvMXJG0tU/slUJyHvsm35JhFrvML5E+CQ+xcVQWDvKjGXTHvTjYB UGCp9NSocjRIIOsyADZ66kmNVkzeDGGpX5NRLuWH5NdrZ2YQuv0SA67VoG8DXOCBvhHZ8X aZv/E7+2zNsvW4rYOaSGTchkllGFr01y3u3lHtsFcJFNjIkS/iZO0BFXEYcIp5QbUwbSdC s2Q+/fVBESK5uYYRNpCEvH2dTBjigAl9LzJHkfengQgtNKd6JoZu8Z0tWZ7+dAPRmEJGJU oCIqsXFnJaLbV1yOgOcztPpkEnDWbt2c/LRugVGf7Syt4sVuuJY3HF+t/s6X4Q== 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 3E032196D8 for ; Thu, 20 Jun 2024 05:46:40 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sK8kS-0006xu-65; Wed, 19 Jun 2024 23:46:08 -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 1sK8kP-0006vO-HU for guix-patches@gnu.org; Wed, 19 Jun 2024 23:46: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 1sK8kP-0007Tr-9J; Wed, 19 Jun 2024 23:46:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sK8kR-0006bZ-F8; Wed, 19 Jun 2024 23:46:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71639] [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:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71639 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 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 71639-submit@debbugs.gnu.org id=B71639.171885513125144 (code B ref 71639); Thu, 20 Jun 2024 03:46:07 +0000 Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:31 +0000 Received: from localhost ([127.0.0.1]:41525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8jq-0006XN-P7 for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:31 -0400 Received: from mail-108-mta193.mxroute.com ([136.175.108.193]:43377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8jo-0006X7-ME for 71639@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:29 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta193.mxroute.com (ZoneMTA) with ESMTPSA id 19033bfbb8000017a3.001 for <71639@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 03:45:21 +0000 X-Zone-Loop: dc8bafc96bda104e40d73c2714f8253afbe708a2f9a5 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 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.36 X-Migadu-Scanner: mx12.migadu.com X-Spam-Score: -3.36 X-Migadu-Queue-Id: 3E032196D8 X-TUID: nF+Rviuuon8m * 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