GNU bug report logs - #71639
[PATCH WIP 0/5] Improve on restic-backup-service

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Richard Sent <richard@HIDDEN>; Keywords: patch; dated Tue, 18 Jun 2024 22:08:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 23 Dec 2024 10:57:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 23 05:57:20 2024
Received: from localhost ([127.0.0.1]:53490 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tPg7j-0006iJ-N1
	for submit <at> debbugs.gnu.org; Mon, 23 Dec 2024 05:57:20 -0500
Received: from confino.investici.org ([93.190.126.19]:27705)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1tPg7e-0006i7-1O
 for 71639 <at> debbugs.gnu.org; Mon, 23 Dec 2024 05:57:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1734951432;
 bh=0KWuQXAVBNpWA8V1k1TQ3MI17b45f/5YH+7PDEXM8Q0=;
 h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
 b=atIdPP4kvN3itVdQ4n002i+evEUwqd1x/En6/aC8ezqTUHqcl5qrgnJdLPxGz43JR
 ISjdUA9pRAcJJ4KaCAo6V0n+Z5THHJhOZ6wbzbFobg2kzD9KU+fgXaUMUhjDQM7Oiq
 ukBMjqzFJbftBOnPozHn7fw0haC8FUJuaMHBdM8Q=
Received: from mx1.investici.org (unknown [127.0.0.1])
 by confino.investici.org (Postfix) with ESMTP id 4YGw2c6jRsz10xD;
 Mon, 23 Dec 2024 10:57:12 +0000 (UTC)
Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19])
 (Authenticated sender: goodoldpaul@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4YGw2c5chYz10wr; Mon, 23 Dec 2024 10:57:12 +0000 (UTC)
Content-Type: multipart/alternative;
 boundary="------------WkZnp9TcRW50dFrmn9Li9Sj2"
Message-ID: <e78634e4-8d8b-4774-9851-e692eee648a1@HIDDEN>
Date: Mon, 23 Dec 2024 11:57:12 +0100
MIME-Version: 1.0
User-Agent: Icedove Daily
Subject: Re: [PATCH WIP 0/5] Improve on restic-backup-service
To: Fabio Natali <me@HIDDEN>, 71639 <at> debbugs.gnu.org
References: <87plpict3u.fsf@HIDDEN>
Content-Language: en-US
From: paul <goodoldpaul@HIDDEN>
In-Reply-To: <87plpict3u.fsf@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

This is a multi-part message in MIME format.
--------------WkZnp9TcRW50dFrmn9Li9Sj2
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Richard and Fabio,

With Shepherd 1.0 we got new shiny timers and I just sent a patch [0] to 
migrate the restic-backup-service type to Shepherd timers. It shouldn't 
break any existing backup (provided a reboot is done after 
configuration) AFAIU. If you don't have objections, I would update the 
plan this way:

1. Implement as a Shepherd timer, with issue#75045

2. Improve the restic backup system service . This can be done in the
current issue #71639:

services: backup: Add password-command support to restic-service
services: backup: Add extra-packages field to restic-backup-job
services: backup: Move restic package to restic-configuration

3. Refactor the restic-guix function to allow for more restic commands
to be wrapped. This can be done in issue #72803:

services: restic-backup: Add more restic commands to the restic-guix
package.

4. Allow for repositories to be initialized with a restic-guix init
command. This commit could be adapted and moved to a new branch based on
#72803:

services: backup: Support bootstrapping an initial restic backup




What do you think?



cheers,

giacomo


[0]: https://issues.guix.gnu.org/75045
--------------WkZnp9TcRW50dFrmn9Li9Sj2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Richard and Fabio,</p>
    <p>With Shepherd 1.0 we got new shiny timers and I just sent a patch
      [0] to migrate the restic-backup-service type to Shepherd timers.
      It shouldn't break any existing backup (provided a reboot is done
      after configuration) AFAIU. If you don't have objections, I would
      update the plan this way:<br>
      <br>
    </p>
    <p>1. Implement as a Shepherd timer, with issue#75045</p>
    <div class="line" id="16-lineno20">2. Improve the restic backup
      system service . This can be done in the </div>
    <div class="line" id="16-lineno21">current issue #71639:</div>
    <br>
    <div class="line" id="16-lineno23">services: backup: Add
      password-command support to restic-service</div>
    <div class="line" id="16-lineno24">services: backup: Add
      extra-packages field to restic-backup-job</div>
    <div class="line" id="16-lineno25">services: backup: Move restic
      package to restic-configuration</div>
    <br>
    <div class="line" id="16-lineno27">3. Refactor the restic-guix
      function to allow for more restic commands </div>
    <div class="line" id="16-lineno28">to be wrapped. This can be done
      in issue #72803:</div>
    <br>
    <div class="line" id="16-lineno30">services: restic-backup: Add more
      restic commands to the restic-guix </div>
    <div class="line" id="16-lineno31">package.</div>
    <br>
    <div class="line" id="16-lineno33">4. Allow for repositories to be
      initialized with a restic-guix init </div>
    <div class="line" id="16-lineno34">command. This commit could be
      adapted and moved to a new branch based on </div>
    <div class="line" id="16-lineno35">#72803:</div>
    <br>
    <div class="line" id="16-lineno37">services: backup: Support
      bootstrapping an initial restic backup</div>
    <br>
    <br>
    <br>
    <br>
    What do you think?<br>
    <br>
    <br>
    <br>
    cheers,<br>
    <br>
    giacomo<br>
    <br>
    <br>
    [0]: <a class="moz-txt-link-freetext" href="https://issues.guix.gnu.org/75045">https://issues.guix.gnu.org/75045</a>
  </body>
</html>

--------------WkZnp9TcRW50dFrmn9Li9Sj2--




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 5 Sep 2024 10:10:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 05 06:10:22 2024
Received: from localhost ([127.0.0.1]:36235 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sm9RW-0002h0-4p
	for submit <at> debbugs.gnu.org; Thu, 05 Sep 2024 06:10:22 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:41583)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1sm9RR-0002gG-1e
 for 71639 <at> debbugs.gnu.org; Thu, 05 Sep 2024 06:10:20 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 6987A60003;
 Thu,  5 Sep 2024 10:08:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fabionatali.com;
 s=gm1; t=1725530924;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to; bh=VfDox+z8RqrFJOrgPOE7lUydHhNB3NlGf36wZvjt1Us=;
 b=J6DRZSMTY5iEN8vU6IOrtnGg8NwSvtYHsRkh3VYdCnKOBys8d6//GJFeAzgKm4PC3i/vDa
 X4mQFggBBHwl8vdnuiRXYss2kgtoCTz+fiPuAwSd+AridZFLdohDt6kdRp0LHkcqGw5lp0
 DRGVIKs5U+3Beixo+9oXXWCl4NtiFgjFqzuRmektKi+REnhf5OIXwulVatM9dZtG++Z844
 n0sbK+9UhV68O3xIb1hvAXRH8HubVB4ZElRLj66HU/v+D1ddBTGSfE9tmy23o7N+LEp3lj
 uqvBglvLwK71vWeLfeBIMNiGRmvm/zXDLHX7GXBty/GYUgfzNs3kzG1H7NVrcQ==
From: Fabio Natali <me@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: Re: [PATCH WIP 0/5] Improve on restic-backup-service
In-Reply-To: <87wmjrqv0k.fsf@HIDDEN>
Date: Thu, 05 Sep 2024 11:06:29 +0100
Message-ID: <87plpict3u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: me@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>,
 paul <goodoldpaul@HIDDEN>, Fabio Natali <me@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Richard and Giacomo.

> >> 1. Improve the restic backup system service [...]
[...]
> Ideally, we'd also move the system tests to 1 so further work can be
> trivially verified by running $ make check-system
> TESTS=restic. That'll require writing an intermediary bootstrapping
> function in the test suite.

+1

> > As a further point, I also think we should manage to update Restic
> > itself to 0.17.0 (while we're still at 0.9.6 which was released in Nov
> > 2019). With such an out-of-date package, the service also risks to loose
> > a little bit of its value.
>
> That would be lovely! One particular feature I'm hopeful for is
> compression support.
>
> Unfortunately restic stopped providing a vendor directory in their
> tarball after 0.9.6 and seemingly has no interest in providing it
> again [1]. Last time I tried guix import with restic I saw some odd
> behavior. Someone with more experience in Go may have better luck.

> [1]: https://github.com/restic/restic/issues/3945

Thanks for the link to the Restic's issue tracker. I think it's actually
better to have the dependencies unbundled and built/imported
individually - although this is causing us some pain at the moment.

Some of the 'guix import go --recursive restic' errors seem to be caused
by Go projects using a slightly different subfolder scheme? There seem
to be various open issues (and semi-finalised patches) around this, such
as:

- https://issues.guix.gnu.org/issue/52362
- https://issues.guix.gnu.org/issue/63001
- https://issues.guix.gnu.org/issue/63647
- https://issues.guix.gnu.org/issue/64035
- https://issues.guix.gnu.org/issue/64036

I'll follow up on one of the threads above and report back here if I
find anything useful.

Thanks, cheers, Fabio.




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 4 Sep 2024 15:50:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 04 11:50:33 2024
Received: from localhost ([127.0.0.1]:35174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1slsHA-0005k8-O2
	for submit <at> debbugs.gnu.org; Wed, 04 Sep 2024 11:50:33 -0400
Received: from mail-108-mta60.mxroute.com ([136.175.108.60]:39133)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1slsH8-0005js-2Z
 for 71639 <at> debbugs.gnu.org; Wed, 04 Sep 2024 11:50:31 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta60.mxroute.com (ZoneMTA) with ESMTPSA id 191bdb9eb750003e01.002
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 04 Sep 2024 15:49:23 +0000
X-Zone-Loop: 24fe8681beb2c9f705d641ae7a8c7c05370d4dc570f4
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-Type:MIME-Version:Message-ID:Date:
 References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:
 Content-Transfer-Encoding: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=T17uX+nF2pEM6taDHgjlJnB0yagDBbjoEPFiaXJ37sU=; b=JvPZKuHtu+fyLwHbc6QJKJIppQ
 O6emmd6wWjUQuA8P7qTpWW4MWNYUvK5KClgT9w6d0mjPrHEzC8H2c7J4efYFtLItr5VhlAxByX7oi
 93vbaP3ubQy9nyC/AFReqH+gbeUigKe4FGu/LJdULqzgwi9AHCgfioMPDGiJ3nUM/YiX2wLCJZeMX
 kUUaNB4yiTozcRoF6C386ch1chuAznP/7rCFFyQFHToIlGSsUOWCY39AlDHGlvWrapGJ1vuFDHVO2
 hHVZqPnFPbxrlMHMCa+Rc0BROK4/lJW63a4jlZlGbW7l4co5aGTJZQvKRxV/lA63NBp5D+4NmyUEQ
 fW14i/tQ==;
From: Richard Sent <richard@HIDDEN>
To: Fabio Natali <me@HIDDEN>
Subject: Re: [bug#71639] [PATCH WIP 0/5] Improve on restic-backup-service
In-Reply-To: <87seugelig.fsf@HIDDEN> (Fabio Natali's message of "Tue, 
 03 Sep 2024 17:43:03 +0100")
References: <cover.1718747513.git.richard@HIDDEN>
 <87seugelig.fsf@HIDDEN>
Date: Wed, 04 Sep 2024 11:49:15 -0400
Message-ID: <87wmjrqv0k.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: 71639 <at> debbugs.gnu.org, paul <goodoldpaul@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Giacomo and Fabio!

I've been struck by the the law of development: the backlog will always
expand to exceed the time available.

>> I apologize for blocking this issue with my proposal. I think Fabio's
>> proposal of splitting the changes in this patch is the best way
>> forward, if you agree as well Richard. I submitted [0] to refactor the
>> restic-guix procedure in a way that it can support many different
>> commands.

That sounds fine with me. I'll try to rebase and resubmit as time is
available (hopefully the next few days......). If my schedule is
inconvenient feel free to do with my patches what you will.

>> 1. Improve the restic backup system service [...]
>> 2. Refactor the restic-guix function [...]
>> 3. Allow for repositories to be initialized with a restic-guix init
>> [...]

Ideally, we'd also move the system tests to 1 so further work can be
trivially verified by running $ make check-system TESTS=restic. That'll
require writing an intermediary bootstrapping function in the test
suite.

> I think this is a perfectly sensible plan. For what it's worth, I've
> provided some little feedback around point 2 as part of #72803.
>
> As a further point, I also think we should manage to update Restic
> itself to 0.17.0 (while we're still at 0.9.6 which was released in Nov
> 2019). With such an out-of-date package, the service also risks to loose
> a little bit of its value.

That would be lovely! One particular feature I'm hopeful for is
compression support.

Unfortunately restic stopped providing a vendor directory in their
tarball after 0.9.6 and seemingly has no interest in providing it again
[1]. Last time I tried guix import with restic I saw some odd behavior.
Someone with more experience in Go may have better luck.

>> Lately I was thinking that may be best to have initialization as a
>> one shot Shepherd service that check whether a given job is supposed
>> to have its repository initialized and if that's the case it could
>> run restic-guix init name-of the job.

Is the intent to have one "mega" one-shot service that checks every job,
or a unique one-shot service per job? I greatly prefer the former as $
sudo herd status is crowded as it is.

It's worth noting users will need the ability to specify custom Shepherd
requirements so e.g. backup initialization to a remote file-share isn't
triggered until the file-system-/my/remote/nas symbol is provisioned by
Shepherd.

On an unrelated note, Shepherd timers are interesting and may allow for
better user management/error signaling instead of mcron. I'm not
proposing we refactor to use them now (especially since they're not even
in stable), but just thought I'd mention them. [2]

[1]: https://github.com/restic/restic/issues/3945
[2]: https://lists.gnu.org/archive/html/guix-devel/2024-03/msg00247.html

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 3 Sep 2024 16:44:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 03 12:44:17 2024
Received: from localhost ([127.0.0.1]:60731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1slWdd-0001Tp-3M
	for submit <at> debbugs.gnu.org; Tue, 03 Sep 2024 12:44:17 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:44303)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1slWdZ-0001TX-TK
 for 71639 <at> debbugs.gnu.org; Tue, 03 Sep 2024 12:44:15 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id A8F24C0003;
 Tue,  3 Sep 2024 16:43:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fabionatali.com;
 s=gm1; t=1725381785;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to; bh=le3vqy97RfxODl8aDoRWspWwxyI6wWifXhvN60HPaZo=;
 b=TLg472ZjfFL97+zTeIy3tJbnr+XuHYiqUKwQC71X9vZ9Im6pDjGoecmWEvKlvxOazNbVxi
 Hee0OvDKTpA7gMAFjP+Pno4L2PV85l+XCaLnB57earrLrvRlznkfHws5bBpIuI8cvajkjs
 gap2GE7DrpuyVewXVxGL5wXACh84jCEVXNWRnx+UxaMH7A7e/wwe0LGOnb1Jj/yPqHN+b1
 +okxnDBqnIWQbkem5/ATohUCp+GvSWvwqb9u6/jzjoPn+h5hB2xfh8mDo4CRUYhMFUeybz
 bMx2NrljFiJ3ksmfqLjXy4vK3iAmySg6uzwMTFCEvJa71tB5hC579/L5DMcDkA==
From: Fabio Natali <me@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: Re: [PATCH WIP 0/5] Improve on restic-backup-service
In-Reply-To: <a576c917-2242-ff16-b95e-e789cf7b07ea@HIDDEN>
Date: Tue, 03 Sep 2024 17:43:03 +0100
Message-ID: <87seugelig.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: me@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>,
 paul <goodoldpaul@HIDDEN>, Fabio Natali <me@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I apologize for blocking this issue with my proposal. I think Fabio's
> proposal of splitting the changes in this patch is the best way
> forward, if you agree as well Richard. I submitted [0] to refactor the
> restic-guix procedure in a way that it can support many different
> commands.

Hi Giacomo,

Thanks for this!

> 1. Improve the restic backup system service [...]

> 2. Refactor the restic-guix function [...]

> 3. Allow for repositories to be initialized with a restic-guix init [...]

I think this is a perfectly sensible plan. For what it's worth, I've
provided some little feedback around point 2 as part of #72803.

As a further point, I also think we should manage to update Restic
itself to 0.17.0 (while we're still at 0.9.6 which was released in Nov
2019). With such an out-of-date package, the service also risks to loose
a little bit of its value.

I've just sent a quick follow-up to #63019 in the hope that we might be
able to get this sorted soon.

Thanks, cheers, Fabio.




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 25 Aug 2024 14:13:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 25 10:13:53 2024
Received: from localhost ([127.0.0.1]:43108 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1siE08-0007bU-Nz
	for submit <at> debbugs.gnu.org; Sun, 25 Aug 2024 10:13:53 -0400
Received: from confino.investici.org ([93.190.126.19]:45929)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1siE06-0007bJ-A2
 for 71639 <at> debbugs.gnu.org; Sun, 25 Aug 2024 10:13:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1724595171;
 bh=mod8hG5f6stJ0OFNE53tZvbzHOd5wi3/2Tdce24Z9dA=;
 h=Date:To:From:Subject:From;
 b=n0WHF9uVLn7j6Dz5OOLHdxpFh4shK8iptIwbgBxOpj9Iwcjea6fLBgIASO+i9iEFW
 OjQTL8L+X3/DoEqD8cUK6l2KAEjEKlMLK9bCbhT8jAbp4o7QzalZ408ARWW2TTCgqH
 z8nQYCJSoHw2y17RrBSb3QuttEjrGHibloPiHOlA=
Received: from mx1.investici.org (unknown [127.0.0.1])
 by confino.investici.org (Postfix) with ESMTP id 4WsG3l6MRwz112c
 for <71639 <at> debbugs.gnu.org>; Sun, 25 Aug 2024 14:12:51 +0000 (UTC)
Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19])
 (Authenticated sender: goodoldpaul@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4WsG3l5xxzz1106
 for <71639 <at> debbugs.gnu.org>; Sun, 25 Aug 2024 14:12:51 +0000 (UTC)
Content-Type: multipart/alternative;
 boundary="------------PsW6uP1wOjXuKKz6zavJfoni"
Message-ID: <a576c917-2242-ff16-b95e-e789cf7b07ea@HIDDEN>
Date: Sun, 25 Aug 2024 16:12:51 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.0
To: 71639 <at> debbugs.gnu.org
Content-Language: en-US
From: paul <goodoldpaul@HIDDEN>
Subject: Re: [PATCHv2 0/5] Improve on restic-backup-service
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Dear Fabio and Richard, I apologize for blocking this issue
 with my proposal. I think Fabio's proposal of splitting the changes in this
 patch is the best way forward, if you agree as well Richard. I submitted
 [0] to refactor [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [93.190.126.19 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 HTML_MESSAGE           BODY: HTML included in message
 2.5 FAKE_REPLY_A1          No description available.
X-Debbugs-Envelope-To: 71639
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.8 (/)

This is a multi-part message in MIME format.
--------------PsW6uP1wOjXuKKz6zavJfoni
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Dear Fabio and Richard,

I apologize for blocking this issue with my proposal. I think Fabio's 
proposal of splitting the changes in this patch is the best way forward, 
if you agree as well Richard. I submitted [0] to refactor the 
restic-guix procedure in a way that it can support many different commands.

After it gets in it should be sufficient to add "init" to 
%restic-guix-supported-actions to have a working restic-guix init 
invokation. it should be then matter of understanding where it is better 
to put it. Lately I was thinking that may be best to have initialization 
as a one shot Shepherd service that check whether a given job is 
supposed to have its repository initialized and if that's the case it 
could run restic-guix init name-of the job. Please Richard let me know 
what you think of this approach and whether you would still be 
interested in implementing it, thank you very much!

I think the following subdivision should match all requirements we 
stated until now:

1. Improve the restic backup system service . This can be done in the 
current issue #71639:

services: backup: Add password-command support to restic-service
services: backup: Add extra-packages field to restic-backup-job
services: backup: Move restic package to restic-configuration

2. Refactor the restic-guix function to allow for more restic commands 
to be wrapped. This can be done in issue #72803:

services: restic-backup: Add more restic commands to the restic-guix 
package.

3. Allow for repositories to be initialized with a restic-guix init 
command. This commit could be adapted and moved to a new branch based on 
#72803:

services: backup: Support bootstrapping an initial restic backup

What do you think? Could this be a suitable action plan?

Thank you very much for your work,

giacomo


[0]: https://issues.guix.gnu.org/72803
--------------PsW6uP1wOjXuKKz6zavJfoni
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Dear Fabio and Richard,</p>
    <p>I apologize for blocking this issue with my proposal. I think
      Fabio's proposal of splitting the changes in this patch is the
      best way forward, if you agree as well Richard. I submitted [0] to
      refactor the restic-guix procedure in a way that it can support
      many different commands.<br>
      <br>
      After it gets in it should be sufficient to add "init" to
      %restic-guix-supported-actions to have a working restic-guix init
      invokation. it should be then matter of understanding where it is
      better to put it. Lately I was thinking that may be best to have
      initialization as a one shot Shepherd service that check whether a
      given job is supposed to have its repository initialized and if
      that's the case it could run restic-guix init name-of the job.
      Please Richard let me know what you think of this approach and
      whether you would still be interested in implementing it, thank
      you very much!<br>
      <br>
      I think the following subdivision should match all requirements we
      stated until now:</p>
    <p>1. Improve the restic backup system service . This can be done in
      the current issue #71639:<br>
    </p>
    <div class="line" id="6-lineno7"> services: backup: Add
      password-command support to restic-service</div>
    <div class="line" id="6-lineno8"> services: backup: Add
      extra-packages field to restic-backup-job</div>
    <div class="line" id="6-lineno9"> services: backup: Move restic
      package to restic-configuration<br>
      <br>
      2. Refactor the restic-guix function to allow for more restic
      commands to be wrapped. This can be done in issue #72803:<br>
      <br>
      services: restic-backup: Add more restic commands to the
      restic-guix package.<br>
      <br>
      3. Allow for repositories to be initialized with a restic-guix
      init command. This commit could be adapted and moved to a new
      branch based on #72803:<br>
      <br>
      services: backup: Support bootstrapping an initial restic backup<br>
      <br>
      What do you think? Could this be a suitable action plan?<br>
      <br>
      Thank you very much for your work,<br>
      <br>
      giacomo<br>
      <br>
      <br>
      [0]: <a class="moz-txt-link-freetext" href="https://issues.guix.gnu.org/72803">https://issues.guix.gnu.org/72803</a></div>
  </body>
</html>

--------------PsW6uP1wOjXuKKz6zavJfoni--




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 22 Aug 2024 17:44:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 22 13:44:49 2024
Received: from localhost ([127.0.0.1]:38304 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1shBrd-0001L5-Ic
	for submit <at> debbugs.gnu.org; Thu, 22 Aug 2024 13:44:49 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:59897)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1shBrZ-0001Kn-OY
 for 71639 <at> debbugs.gnu.org; Thu, 22 Aug 2024 13:44:48 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 685EB1C0003
 for <71639 <at> debbugs.gnu.org>; Thu, 22 Aug 2024 17:43:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fabionatali.com;
 s=gm1; t=1724348632;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=Ic//i6ynT8eNv7nEmrOzU4Glggk8Z+FMHlKiz8X+Lc4=;
 b=k9jsrA6l/er4LRFJoBLwoaRNYlXShEcYueZIL0EadU8mnCgfAc3WUakJI8XIQLR/xQkN71
 tkbRPb6hh88tE35FHwv9xAeHcRaoIW2/3eyQqDxpsZiDyAgJXU23ZjBoqQJfZ2oYYzvr8F
 mBY+21MNyMVL/j3HQHHHHal/S50GuzL+Z+C3GyArsp3iw3pTCf7xNMRPnze74UeVDA+xt8
 Winc7hf6NEASZu9bCGGrbshIghi3uMTlHX5A1m5QVHdOtIeZ799PmJMEBBnbXAsOSYHAMn
 0qdl2sMdfUBHhxEL01PEUhBArKW44iejj22vRW+G86VEDi+ygz4s9HH85WOXDA==
From: Fabio Natali <me@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: Re: [bug#71639] [PATCHv2 0/5] Improve on restic-backup-service
Date: Thu, 22 Aug 2024 18:43:51 +0100
Message-ID: <87wmk8h2qw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: me@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71639
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Giacomo,

Thanks for adding the Restic Service to Guix.

Hi Richard,

Thanks for patch request 71639, which includes a few changes I'm looking
forward to. For instance, I like the idea of exposing the
'RESTIC_PASSWORD_COMMAND' variable directly via the service
configuration.

I think I might still be able to use the 'extra-flags' field to specify
a '--password-command' - if I understand it correctly - but direct
access to the option would be neat indeed.

Anything I can do to help with the patch? Could it make sense to break
the patch down into a couple of stages, possibly leaving the most
impactful changes for a later stage?

Thanks, cheers, Fabio.




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 7 Jul 2024 20:41:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 16:41:15 2024
Received: from localhost ([127.0.0.1]:49241 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sQYh8-0005IZ-Uq
	for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 16:41:15 -0400
Received: from confino.investici.org ([93.190.126.19]:54305)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1sQYh3-0005IN-7w
 for 71639 <at> debbugs.gnu.org; Sun, 07 Jul 2024 16:41:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1720384856;
 bh=jqmJywMAmKIxz6GnC9iVndXewd7cWcvau4j9ZU9s/9w=;
 h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
 b=U5G1aS53iJc2g4cd9JQQwm6jqVcgiggfcG8C+BaQ19Ower3VgYGl3V9NqRImUYmh2
 oO3qYlUr51MrskmIrCL6uzG/fjbEebUC5JXT77iQZpUQpO1jE7blPzot2HgQRbvSBq
 aO8hcWyGsfCQDlRbiWNku06oT0DgFPYY9ikrVRBo=
Received: from mx1.investici.org (unknown [127.0.0.1])
 by confino.investici.org (Postfix) with ESMTP id 4WHK0814Wsz113Q;
 Sun,  7 Jul 2024 20:40:56 +0000 (UTC)
Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19])
 (Authenticated sender: goodoldpaul@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4WHK080TgBz113B; Sun,  7 Jul 2024 20:40:56 +0000 (UTC)
Content-Type: multipart/alternative;
 boundary="------------0AUI3b7ugkoDOwffHzMeGDkc"
Message-ID: <18da4124-465c-fa58-6e8f-d9daf751443c@HIDDEN>
Date: Sun, 7 Jul 2024 22:40:55 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.0
Subject: Re: [PATCHv2 0/5] Improve on restic-backup-service
To: Richard Sent <richard@HIDDEN>
References: <87ikxvvy0o.fsf@HIDDEN>
Content-Language: en-US
From: paul <goodoldpaul@HIDDEN>
In-Reply-To: <87ikxvvy0o.fsf@HIDDEN>
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 71639
Cc: 71639 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.7 (---)

This is a multi-part message in MIME format.
--------------0AUI3b7ugkoDOwffHzMeGDkc
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Richard,

On 6/27/24 05:56, Richard Sent wrote:
> I'll take a look at it and see what the code looks like. It might be a
> bit of effort to get that working cleanly while avoiding code dupe. For
> instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup
> program actions.
Yes, 100% agree. What I would do is (and probably there is a better way):

- rename restic-backup-job-program to restic-action-job-program or 
something similar. the procedure would be the same but it would take two 
additional arguments: an action-name argument or similar that would 
replace all instances of "backup" and I think this new procedure should 
not access the files field of the job record but it instead it would 
take an action-arguments argument which would replace #$@files with 
#$@action-arguments in the execlp call. This way, I hope, it could be 
general enough to support additional actions besides init in the future, 
such as purge or restore.

- create a new restic-backup-job-program and a restic-init-job-program 
or similar procedures that would call the new generic 
restic-action-job-program

- inside the restic-guix procedure I'd rename the programs list to 
backup-programs and I would create a similar list for the init action 
with #f placeholders for jobs that do not require initializing, and I 
would check the conditional inside the backup procedure something like:

(define (get-program name programs)
   [...])

(define (init args)
  [...])

(define (backup args)
   (define name (third args))
   (define backup-program (get-program name backup-programs))
   (define init-program (get-program name init-programs))
   (when init-program
     (init args))
   (execlp backup-program backup-program))


this requires the init action not to exec the script resulting from the 
gexp but I can't think of a reason why it could be problematic right now 
so I guess it is ok.

Please take all of the above as a proposal there are for sure things to 
make better.

> Thanks for the feedback!

Thank you very much for your work,

giacomo

--------------0AUI3b7ugkoDOwffHzMeGDkc
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Richard,<br>
    </p>
    <div class="moz-cite-prefix">On 6/27/24 05:56, Richard Sent wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:87ikxvvy0o.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">I'll take a look at it and see what the code looks like. It might be a
bit of effort to get that working cleanly while avoiding code dupe. For
instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup
program actions.
</pre>
    </blockquote>
    Yes, 100% agree. What I would do is (and probably there is a better
    way):<br>
    <br>
    - rename restic-backup-job-program to restic-action-job-program or
    something similar. the procedure would be the same but it would take
    two additional arguments: an action-name argument or similar that
    would replace all instances of "backup" and I think this new
    procedure should not access the files field of the job record but it
    instead it would take an action-arguments argument which would
    replace #$@files with #$@action-arguments in the execlp call. This
    way, I hope, it could be general enough to support additional
    actions besides init in the future, such as purge or restore.<br>
    <br>
    - create a new restic-backup-job-program and a
    restic-init-job-program or similar procedures that would call the
    new generic restic-action-job-program<br>
    <br>
    - inside the restic-guix procedure I'd rename the programs list to
    backup-programs and I would create a similar list for the init
    action with #f placeholders for jobs that do not require
    initializing, and I would check the conditional inside the backup
    procedure something like:<br>
    <pre>
(define (get-program name programs)
  [...])

(define (init args)
 [...])

(define (backup args)
  (define name (third args))
  (define backup-program (get-program name backup-programs))
  (define init-program (get-program name init-programs))
  (when init-program
    (init args))
  (execlp backup-program backup-program))</pre>
    <br>
    this requires the init action not to exec the script resulting from
    the gexp but I can't think of a reason why it could be problematic
    right now so I guess it is ok.<br>
    <br>
    Please take all of the above as a proposal there are for sure things
    to make better.<br>
    <br>
    <blockquote type="cite"
      cite="mid:87ikxvvy0o.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">Thanks for the feedback!
</pre>
    </blockquote>
    <p>Thank you very much for your work,<br>
      <br>
      giacomo<br>
    </p>
  </body>
</html>

--------------0AUI3b7ugkoDOwffHzMeGDkc--




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 27 Jun 2024 03:57:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 23:57:12 2024
Received: from localhost ([127.0.0.1]:40650 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sMgG0-0002sE-GB
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2024 23:57:12 -0400
Received: from mail-108-mta11.mxroute.com ([136.175.108.11]:33911)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sMgFy-0002s5-8C
 for 71639 <at> debbugs.gnu.org; Wed, 26 Jun 2024 23:57:11 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta11.mxroute.com (ZoneMTA) with ESMTPSA id 19057d6feb300017a3.002
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 27 Jun 2024 03:57:06 +0000
X-Zone-Loop: f9a11ce01b11d57660a63ad3192a6c1dffb440b41f14
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-Type:MIME-Version:Message-ID:Date:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:References:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wIXhuebS9ReqAoOON9tKnXP0XDpsRVVNpscr7oLJpjQ=; b=bJSZ1lKTS6+vD34PbUbngbB5Ae
 NWSinVSWRKpjELNSyrD2YuhZirKY4MmIw5sdG7p3FnEuKm6/ouS4ChHb12Gc1lfvqvdQSvEKJlqqP
 vyVOzvBYGD/QrlbO1f0uJrIymgJeu/MgWOdJzkL/aKj0nylTBlWIz1ggFqtNgwYyS1OW4YcZd1IC8
 vPLCO6sSOo1Hc2mTdSGJkxtFyc8tjTP/k6ezmoSMAcv8br1V0Jr2cVMFpn3T7KebTFN8onTivFsXN
 OCgZyyeVJiOXnTV1Nmn9JwXe/j2LEFuhq4/n6dU1xi5RpXLKhLPTGovVuKKxv285yKDD3t1c+zGFd
 UswPxT9Q==;
From: Richard Sent <richard@HIDDEN>
To: paul <goodoldpaul@HIDDEN>
Subject: Re: [PATCHv2 0/5] Improve on restic-backup-service
In-Reply-To: <c4483a64-abf2-62d4-78a2-05c6bf349857@HIDDEN> (message
 from paul on Tue, 25 Jun 2024 00:49:07 +0200)
Date: Wed, 26 Jun 2024 23:56:55 -0400
Message-ID: <87ikxvvy0o.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: 71639 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi giacomo,

> I think it would be nice to have an init action for the restic-guix
> command shipped with the service and move there the logic for
> initializing repositories. The service then could be adapted in a way
> that it would call the restic-guix init before calling restic-guix
> backup. Would you be interested in implementing this?

I'll take a look at it and see what the code looks like. It might be a
bit of effort to get that working cleanly while avoiding code dupe. For
instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup
program actions.

Where do you think the appropriate place to check init? and run the init
action is if it's no longer encapsulated in the backup action? A
conditional in restic-backup-job->mcron-job before launching restic-guix
backup? A one-shot shepherd service?

The former will necessitate adding a job string to display when running
$ herd schedule mcron. A downside of the latter is if the restic
repository is deleted for one reason or another that backup job will
fail until the system is rebooted, which isn't immediately obvious.
Personally I prefer the mcron-job conditional.

> At last, my use case for having a restic package field for each job is 
> to have some critical jobs that I don't want to touch running with 
> Guix's bootstrapped restic package and some personal jobs that I run 
> with a restic 0.16 binary package I have in my personal channel . I'm 
> not sure this warrants a field in each single job, but they are optional 
> anyway. Anyway I wouldn't consider this a blocker and if the Guix 
> project has some guidelines in this sense I'd say follow them.

Ah, I see. To me this is where a per-job restic-override or similarly
named field makes sense. This way we can have a default "global" restic
package configured at a service level while still allowing individual
jobs to use a custom restic package. I imagine this restic-override
field would be a "maybe-file-like" either set to #f or a custom restic
package.

Thanks for the feedback!

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 24 Jun 2024 22:49:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 18:49:21 2024
Received: from localhost ([127.0.0.1]:35778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLsUz-0000Oq-2o
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2024 18:49:21 -0400
Received: from confino.investici.org ([93.190.126.19]:28961)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1sLsUw-0000Of-18
 for 71639 <at> debbugs.gnu.org; Mon, 24 Jun 2024 18:49:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1719269347;
 bh=tC2IGqUP0MS8n/04fN2L2Gi/CjzuoM+mPYmPnqba+s0=;
 h=Date:To:Cc:References:Subject:From:In-Reply-To:From;
 b=RpP037rtb1DlgDtSRZOjrZfxDCuHpX1gNGQlQSSl/4YolZyrOYETLNWVCcxgrp8Bq
 +h//TfDJqeG1C/uktQ1sKGESKzIrctj7k/pundyRM7jxSm3YKa8QijM+786zz2INfg
 6W5poRAAZVxrsM61GlBkpW5LGO1fYJY9V7hHvFHQ=
Received: from mx1.investici.org (unknown [127.0.0.1])
 by confino.investici.org (Postfix) with ESMTP id 4W7NS35zZLz112F;
 Mon, 24 Jun 2024 22:49:07 +0000 (UTC)
Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19])
 (Authenticated sender: goodoldpaul@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4W7NS35XLyz1127; Mon, 24 Jun 2024 22:49:07 +0000 (UTC)
Message-ID: <c4483a64-abf2-62d4-78a2-05c6bf349857@HIDDEN>
Date: Tue, 25 Jun 2024 00:49:07 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.0
To: 71639 <at> debbugs.gnu.org
References: <e6e444a7e2a4ec32fca27a5098070947974abcd4.1718854920.git.richard@HIDDEN>
Subject: Re: [PATCHv2 0/5] Improve on restic-backup-service
Content-Language: en-US
From: paul <goodoldpaul@HIDDEN>
In-Reply-To: <e6e444a7e2a4ec32fca27a5098070947974abcd4.1718854920.git.richard@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.7 (---)

Hi Richard,

thank you for this work, it looks really useful and in general I think 
the patches are ok but I have some points I'd like to discuss.

I think it would be nice to have an init action for the restic-guix 
command shipped with the service and move there the logic for 
initializing repositories. The service then could be adapted in a way 
that it would call the restic-guix init before calling restic-guix 
backup. Would you be interested in implementing this?

At last, my use case for having a restic package field for each job is 
to have some critical jobs that I don't want to touch running with 
Guix's bootstrapped restic package and some personal jobs that I run 
with a restic 0.16 binary package I have in my personal channel . I'm 
not sure this warrants a field in each single job, but they are optional 
anyway. Anyway I wouldn't consider this a blocker and if the Guix 
project has some guidelines in this sense I'd say follow them.

Cheers,

giacomo







Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:38 2024
Received: from localhost ([127.0.0.1]:41531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jx-0006Xx-Sf
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:38 -0400
Received: from mail-108-mta59.mxroute.com ([136.175.108.59]:41889)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sK8jt-0006Xi-K2
 for 71639 <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:34 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta59.mxroute.com (ZoneMTA) with ESMTPSA id 19033bfc8c300017a3.001
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 20 Jun 2024 03:45:25 +0000
X-Zone-Loop: 5f8cda417666a3ac5f2463956442d5b0884c7d2180b2
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:Content-Type:
 MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender
 :Reply-To: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=ID4dv26EDja7geOt5SQBFDdNXc/hjEVNkcddZN2hvx0=; b=F+HHUaRzWlrilLBq2mvVYqJyez
 Aa1mZO6dxkkO+9/5bWjiHa0nWWKgo79NqdOW19SKrarDA2Qzb8j+1+YptHFfBnDJgDpjDByX5eveD
 6/S2k3w0Q30tnL3rVPe0ADWv6fewPyJuwnMQo1Za6pKbZ/XpEz3iKx1z9yj5cbm37uJhUtP5SvQ93
 qk2HKGUMAAax3gmcRqyVe/p5W7WH1MlmuOjY7X26nkOLXu9fOFBFkumPAGfum1vyVXzmw9/PK54hk
 8DTuRs+pOqKJRSGcTEOFpOWD08Jq//gwViD/MYtvXkhXS2N9cJL1U/24d+kXTfDm2FZB1vyfJqPK2
 64dAlfiw==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 5/5] tests: Add restic system test.
Date: Wed, 19 Jun 2024 23:44:16 -0400
Message-ID: <e6e444a7e2a4ec32fca27a5098070947974abcd4.1718854920.git.richard@HIDDEN>
In-Reply-To: <cover.1718854920.git.richard@HIDDEN>
References: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/tests/restic.scm: Create.

Change-Id: Iad5472414c140b133d9b402855bb2f01e96bb0cc
---
 gnu/tests/restic.scm | 119 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 gnu/tests/restic.scm

diff --git a/gnu/tests/restic.scm b/gnu/tests/restic.scm
new file mode 100644
index 0000000000..8d29ff441b
--- /dev/null
+++ b/gnu/tests/restic.scm
@@ -0,0 +1,119 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Richard Sent <richard@HIDDEN>.
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests restic)
+  #:use-module (gnu bootloader)
+  #:use-module (gnu bootloader grub)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages sync)      ;rclone
+  #:use-module (gnu services)
+  #:use-module (gnu services backup)    ;restic
+  #:use-module (gnu system)
+  #:use-module (gnu system vm)
+  #:use-module (gnu tests)
+  #:use-module (guix gexp)
+  #:use-module (guix modules)
+  #:use-module (srfi srfi-1)
+  #:export (%test-restic))
+
+(define password "password")
+
+(define password-file
+  (plain-file "password-file" password))
+
+(define password-command
+  (program-file "password-command" #~(display #$password)))
+
+(define (run-restic-test)
+  "Run tests in %restic-os."
+
+  (define os
+    (marionette-operating-system
+     (simple-operating-system (extra-special-file "/root/.restic-test"
+                                                  (plain-file "restic-test"
+                                                              "Hello world!"))
+                              ;; restic-backup-service only takes a string to avoid putting
+                              ;; plaintext entries in the store. Ergo, symlink it.
+                              (extra-special-file "/root/password-file"
+                                                  password-file)
+                              (service restic-backup-service-type
+                                       (restic-backup-configuration
+                                        (jobs
+                                         (list (restic-backup-job
+                                                (name "password-file-backup")
+                                                (repository "/root/restic-password-file-repo")
+                                                (schedule #~'(next-second '(0 15 30 45)))
+                                                (password-file "/root/password-file")
+                                                (files '("/root/.restic-test"))
+                                                (init? #t))
+                                               (restic-backup-job
+                                                (name "password-command-backup")
+                                                (repository "/root/restic-password-command-repo")
+                                                (schedule #~'(next-second '(0 15 30 45)))
+                                                (password-command password-command)
+                                                (files '("/root/.restic-test"))
+                                                (init? #t)))))))
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm (virtual-machine
+              (operating-system os)
+              (memory-size 512)))
+
+  (define test
+    (with-imported-modules (source-module-closure
+                            '((gnu build marionette)))
+      #~(begin
+          (use-modules (gnu build marionette)
+                       (srfi srfi-26)
+                       (srfi srfi-64))
+
+          (let ((marionette (make-marionette (list #$vm))))
+
+            (test-runner-current (system-test-runner #$output))
+            (test-begin "restic")
+
+            (test-assert "backup-file-created"
+              (wait-for-file "/root/.restic-test" marionette))
+
+            (test-assert "mcron running"
+              (marionette-eval
+               '(begin
+                  (use-modules (gnu services herd))
+                  (start-service 'mcron))
+               marionette))
+
+            (test-assert "password-file backup completed"
+              (wait-for-file "/root/restic-password-file-repo/config" marionette
+                             ;; Restic takes a second to run, give it a bit
+                             ;; more time.
+                             #:timeout 20))
+
+            (test-assert "password-comand backup completed"
+              (wait-for-file "/root/restic-password-file-repo/config" marionette
+                             #:timeout 20))
+
+            (test-end)))))
+
+  (gexp->derivation "restic-test" test))
+
+(define %test-restic
+  (system-test
+   (name "restic")
+   (description "Basic tests for the restic service.")
+   (value (run-restic-test))))
-- 
2.45.1





Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:31 2024
Received: from localhost ([127.0.0.1]:41527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jr-0006XV-CP
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:31 -0400
Received: from mail-108-mta40.mxroute.com ([136.175.108.40]:38055)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sK8jo-0006X6-Ok
 for 71639 <at> 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-mta40.mxroute.com (ZoneMTA) with ESMTPSA id 19033bfb1bd00017a3.001
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 20 Jun 2024 03:45:19 +0000
X-Zone-Loop: 40fc093c7284c01ad284acc37e9379cd19a3c99afb6a
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=D/jSR4oJbdjWYkLbQ9/74+ANzsyVjGZypdjZdGeHSoQ=; b=lW1HUPBSX4Z0GxvZHPdeP9uvje
 xi2BogCkv7F9YMSRnmBkV+IUgdrxlquH30pIFRROK/v9yohA+pRTjluW7MM9B0vaP8Q09YfqGT77X
 6CVMDtWITy8xUKhc/J5criMz25pQRfYFKHvMWYp1XCCNY+4kMW/mv6FgsgKtD3TTKZ6QMr9QA4Yhr
 iTc/F9X46+GDgd/MWw95DCsof9L/+rb58Ec93Die8OZSYpC8iL2wCX/qvcaDO/DBPnaSILQnmDO3W
 xCiJ+2Ca1uVKT++5UkxvgGI56OhGPAXJ6y4qoP3P6lVcVJbBP5iJRbxo4kMqo6c9/ffOx2JivDq0b
 vbwaULvg==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 3/5] services: backup: Add extra-packages field to
 restic-backup-job
Date: Wed, 19 Jun 2024 23:44:14 -0400
Message-ID: <b0253ce5f357e984716314a191a3f55380455e66.1718854920.git.richard@HIDDEN>
In-Reply-To: <cover.1718854920.git.richard@HIDDEN>
References: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm (restic-backup-job): Create extra-packages.
(restic-guix-wrapper-package): Add the extra-packages field of every job as
inputs.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: I4f0b070bc6dc895553ba69256d14e45898291c02
---
 doc/guix.texi           |  4 ++++
 gnu/services/backup.scm | 33 ++++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f22d679023..32ce0c86b9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41367,6 +41367,10 @@ Miscellaneous Services
 @item @code{verbose?} (default: @code{#f}) (type: boolean)
 Whether to enable verbose output for the current backup job.
 
+@item @code{extra-packages} (default: @code{'()} (type: list-of-packages)
+The list of extra packages needed for restic to run the current backup
+job.
+
 @item @code{extra-flags} (default: @code{'()}) (type: list-of-lowerables)
 A list of values that are lowered to strings.  These will be passed as
 command-line arguments to the current job @command{restic backup}
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index fd904bc9a9..bfbacfe590 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -41,6 +41,7 @@ (define-module (gnu services backup)
             restic-backup-job-files
             restic-backup-job-init?
             restic-backup-job-verbose?
+            restic-backup-job-extra-packages
             restic-backup-job-extra-flags
 
             restic-backup-configuration
@@ -102,6 +103,9 @@ (define-configuration/no-serialization restic-backup-job
    (list-of-lowerables '())
    "The list of files or directories to be backed up.  It must be a list of
 values that can be lowered to strings.")
+  (extra-packages
+   (list-of-packages '())
+   "The list of extra packages needed for restic to run this backup job.")
   (verbose?
    (boolean #f)
    "Whether to enable verbose output for the current backup job.")
@@ -237,22 +241,25 @@ (define (restic-backup-job->mcron-job config)
            #:user #$user)))
 
 (define (restic-guix-wrapper-package jobs)
-  (package
-    (name "restic-backup-service-wrapper")
-    (version "0.0.0")
-    (source (restic-guix jobs))
-    (build-system copy-build-system)
-    (arguments
-     (list #:install-plan #~'(("./" "/bin"))))
-    (home-page "https://restic.net")
-    (synopsis
-     "Easily interact from the CLI with Guix configured backups")
-    (description
-     "This package provides a simple wrapper around @code{restic}, handled
+  (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))
+      (build-system copy-build-system)
+      (arguments
+       (list #:install-plan #~'(("./" "/bin"))))
+      (home-page "https://restic.net")
+      (synopsis
+       "Easily interact from the CLI with Guix configured backups")
+      (description
+       "This package provides a simple wrapper around @code{restic}, handled
 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.")
-    (license license:gpl3+)))
+      (inputs extra-packages)
+      (license license:gpl3+))))
 
 (define restic-backup-service-profile
   (lambda (config)
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:31 2024
Received: from localhost ([127.0.0.1]:41525 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jq-0006XN-P7
	for submit <at> 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 <richard@HIDDEN>) id 1sK8jo-0006X7-ME
 for 71639 <at> 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 <at> 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 <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 4/5] services: backup: Move restic package to
 restic-configuration
Date: Wed, 19 Jun 2024 23:44:15 -0400
Message-ID: <56345eb5926246798f52424883caa3fd0e88cee8.1718854920.git.richard@HIDDEN>
In-Reply-To: <cover.1718854920.git.richard@HIDDEN>
References: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* 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





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:27 2024
Received: from localhost ([127.0.0.1]:41519 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jm-0006Wt-Q9
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:27 -0400
Received: from mail-108-mta163.mxroute.com ([136.175.108.163]:39047)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sK8jj-0006WY-KW
 for 71639 <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:24 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta163.mxroute.com (ZoneMTA) with ESMTPSA id
 19033bfa8c000017a3.001 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 20 Jun 2024 03:45:16 +0000
X-Zone-Loop: 4dd2bf6639c82ef89d096319cbe36045007653f6a2ea
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=yyBICg4O1y0fUS6c0vVAsrc8LuuVW7gya8VicEXI1fk=; b=GV2Ok24XjA7ipc7LweVS/akMPJ
 GnvlF2ytNRNvCP97oj09QU6JHrsJPziR1VEk9mqgEKju/D62kCwzQ9T5IKhD7fhOnF0fYU4+FBhk0
 HmpQxEsElwAntkP248iZjJ+r95W1fd7OgIl9SQ4graa9HieTBCtuRU4jNNDtTOZCinYQA35vL+et4
 IOp5/LNNeYsWnhLoWi+MH61nvK+5b0QQ+OE3Q6CzQyqPyZCtqa4ZtCpFhhSXrf/GFJBZ4e/umbU6K
 68xRsfxPxBj26oCvX8lVLuUDBRrq1DjASBsr+SrxkKe/PDrsBo4wKnPSSnnJN6AVyVAzGgHU2BN2l
 CsGZVQqA==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 2/5] services: backup: Add password-command support to
 restic-service
Date: Wed, 19 Jun 2024 23:44:13 -0400
Message-ID: <ceb1cc05b9c66b1f3d0ca59ba5548921d71cb11b.1718854920.git.richard@HIDDEN>
In-Reply-To: <cover.1718854920.git.richard@HIDDEN>
References: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm (restic-backup-job): Add password-command.
(verify-restic-backup-job-configuration): Create.
(restic-backup-job-program): Set either RESTIC_PASSWORD or
RESTIC_PASSWORD_COMMAND depending on what is configured.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: Ice9cf85d1ee4485a2737f515c63c969918219df0
---
 doc/guix.texi           |  7 +++++++
 gnu/services/backup.scm | 41 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 63c9cbd1a7..f22d679023 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41344,6 +41344,13 @@ Miscellaneous Services
 that will be used to set the @env{RESTIC_PASSWORD} environment variable
 for the current job.
 
+@item @code{password-command} (type: file-like)
+String path or file-like object representing the executable file that
+prints password to stdout.  If a file-like object is used, it is placed
+in the store globally executable and in plain text.  The executable
+should be designed such that it does not compromise the password if an
+unauthorized user runs it.
+
 @item @code{schedule} (type: gexp-or-string)
 A string or a gexp that will be passed as time specification in the
 mcron job specification (@pxref{Syntax, mcron job specifications,,
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index 1279ece88f..fd904bc9a9 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -66,6 +66,9 @@ (define (lowerable? value)
 (define list-of-lowerables?
   (list-of lowerable?))
 
+(define-maybe/no-serialization string)
+(define-maybe/no-serialization file-like)
+
 (define-configuration/no-serialization restic-backup-job
   (restic
    (package restic)
@@ -80,10 +83,16 @@ (define-configuration/no-serialization restic-backup-job
    (string)
    "The restic repository target of this job.")
   (password-file
-   (string)
+   (maybe-string)
    "Name of the password file, readable by the configured @code{user}, that
 will be used to set the @code{RESTIC_PASSWORD} environment variable for the
 current job.")
+  (password-command
+   (maybe-file-like)
+   "An executable file who's path is stored in @code{RESTIC_PASSWORD_COMMAND}.
+When run, the file writes the password to standard output. Due to the nature
+of the store this command will be globally executable and should have external
+protections to ensure unauthorized users cannot retrieve the password.")
   (schedule
    (gexp-or-string)
    "A string or a gexp that will be passed as time specification in the mcron
@@ -104,6 +113,14 @@ (define-configuration/no-serialization restic-backup-job
    "A list of values that are lowered to strings.  These will be passed as
 command-line arguments to the current job @command{restic backup} invokation."))
 
+(define (verify-restic-backup-job-configuration config)
+  (unless (or (maybe-value-set? (restic-backup-job-password-file config))
+              (maybe-value-set? (restic-backup-job-password-command config)))
+    (error "either password-file or password-command must be configured."))
+  (when (and (maybe-value-set? (restic-backup-job-password-file config))
+             (maybe-value-set? (restic-backup-job-password-command config)))
+    (error "password-file and password-command can not be configured simultaneously.")))
+
 (define list-of-restic-backup-jobs?
   (list-of restic-backup-job?))
 
@@ -113,12 +130,21 @@ (define-configuration/no-serialization restic-backup-configuration
    "The list of backup jobs for the current system."))
 
 (define (restic-backup-job-program config)
+  (define (maybe-value-or-false maybe)
+    (if (maybe-value-set? maybe)
+        maybe
+        #f))
+
+  (verify-restic-backup-job-configuration config)
+
   (let ((restic
          (file-append (restic-backup-job-restic config) "/bin/restic"))
         (repository
          (restic-backup-job-repository config))
         (password-file
-         (restic-backup-job-password-file config))
+         (maybe-value-or-false (restic-backup-job-password-file config)))
+        (password-command
+         (maybe-value-or-false (restic-backup-job-password-command config)))
         (files
          (restic-backup-job-files config))
         (extra-flags
@@ -134,9 +160,14 @@ (define (restic-backup-job-program config)
      #~(begin
          (use-modules (ice-9 popen)
                       (ice-9 rdelim))
-         (setenv "RESTIC_PASSWORD"
-                 (with-input-from-file #$password-file read-line))
-
+         (or (and=> #$password-file (lambda (x)
+                                      (setenv "RESTIC_PASSWORD"
+                                              (with-input-from-file x read-line))))
+             (and=> #$password-command (lambda (x)
+                                         (setenv "RESTIC_PASSWORD_COMMAND" x)))
+             ;; Have a backup error message in case
+             ;; verify-restic-backup-job-configuration is messed with
+             (error "Neither password-file or password-command set"))
          (when #$init?
            ;; Use cat config to check if the repository exists. See
            ;; https://github.com/restic/restic/issues/1690 and
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:21 2024
Received: from localhost ([127.0.0.1]:41510 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jg-0006WL-Jl
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:21 -0400
Received: from mail-108-mta189.mxroute.com ([136.175.108.189]:46611)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sK8je-0006WD-Gh
 for 71639 <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:19 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta189.mxroute.com (ZoneMTA) with ESMTPSA id
 19033bf912d00017a3.001 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 20 Jun 2024 03:45:10 +0000
X-Zone-Loop: 7cc763cf7e3f2d30d9e9b0a272900d0add3fd1629f38
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:Content-Type:
 MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender
 :Reply-To: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=XuD2yRINfgfD1RxfCnun9Fbl0b2Udso5fzV/vwuymPk=; b=iH+5ATU6mhxxQ8dDht0NQlabJ9
 ofVRq2IeEXVDFkdqrxRWhVp/0uizYuAbS0WNE9OWW417aZ6hY5mCAyVixHRFyEAlBGMtXVjcEL9Oa
 KLYtc20QwnQ2EOLyzNJ2peWtO4JP+IKVJiyyPSVfXgBtf952Lu77MvFyo6bUCpvSngRpfm/fny/2J
 NYoqpFzWwuR+e/C4XgIjnB6HFdRu0rLiNi1+YX3WG6SdBNf4KWSp8uMjwnJGzoOOXRPvvppO1I0g6
 Pg5LADgSLTN19/sdSvJ0dgynu1kd1SQewZILlzB838Ccvv9IJuFGQvSDlhu8nconbm5iJyAhJ3wwQ
 PbpglJhw==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 1/5] services: backup: Support bootstrapping an initial
 restic backup
Date: Wed, 19 Jun 2024 23:44:12 -0400
Message-ID: <93ff43dbc77df724597c7c27ae955581a31a851e.1718854920.git.richard@HIDDEN>
In-Reply-To: <cover.1718854920.git.richard@HIDDEN>
References: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm: (restic-backup-job): Add init? field.
(restic-backup-job-program): Initialize repository if init? is set and
repository does not already exist.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: I71d0cbaac646b9d160e662b69286f229b9a9f64d
---
 doc/guix.texi           |  4 ++++
 gnu/services/backup.scm | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 0102fd0fad..63c9cbd1a7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41353,6 +41353,10 @@ Miscellaneous Services
 The list of files or directories to be backed up.  It must be a list of
 values that can be lowered to strings.
 
+@item @code{init?} (default: @code{#f}) (type: boolean)
+Whether restic-backup-service should check and (if it does not exist)
+initialize the repository before running the backup.
+
 @item @code{verbose?} (default: @code{#f}) (type: boolean)
 Whether to enable verbose output for the current backup job.
 
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index 555e9fc959..1279ece88f 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@HIDDEN>
+;;; Copyright © 2024 Richard Sent <richard@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,7 @@ (define-module (gnu services backup)
             restic-backup-job-password-file
             restic-backup-job-schedule
             restic-backup-job-files
+            restic-backup-job-init?
             restic-backup-job-verbose?
             restic-backup-job-extra-flags
 
@@ -94,6 +96,9 @@ (define-configuration/no-serialization restic-backup-job
   (verbose?
    (boolean #f)
    "Whether to enable verbose output for the current backup job.")
+  (init?
+   (boolean #f)
+   "Whether to attempt to initialize a new repository for automated bootstrap purposes.")
   (extra-flags
    (list-of-lowerables '())
    "A list of values that are lowered to strings.  These will be passed as
@@ -118,6 +123,8 @@ (define (restic-backup-job-program config)
          (restic-backup-job-files config))
         (extra-flags
          (restic-backup-job-extra-flags config))
+        (init?
+         (restic-backup-job-init? config))
         (verbose
          (if (restic-backup-job-verbose? config)
              '("--verbose")
@@ -130,6 +137,18 @@ (define (restic-backup-job-program config)
          (setenv "RESTIC_PASSWORD"
                  (with-input-from-file #$password-file read-line))
 
+         (when #$init?
+           ;; Use cat config to check if the repository exists. See
+           ;; https://github.com/restic/restic/issues/1690 and
+           ;; https://github.com/NixOS/nixpkgs/pull/307962.
+           ;;
+           ;; XXX: restic returns values other than 1 on failure. Check
+           ;; EXIT_SUCCESS instead of EXIT_FAILURE.
+           (unless (or (equal? EXIT_SUCCESS (system* #$restic "cat" "config"
+                                                     "-r" #$repository))
+                       (equal? EXIT_SUCCESS (system* #$restic "init"
+                                                     "-r" #$repository)))
+             (error "Failed to initialize restic repository: " #$repository)))
          (execlp #$restic #$restic #$@verbose
                  "-r" #$repository
                  #$@extra-flags
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 20 Jun 2024 03:45:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 23:45:11 2024
Received: from localhost ([127.0.0.1]:41499 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sK8jW-0006Vg-Qc
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:11 -0400
Received: from mail-108-mta50.mxroute.com ([136.175.108.50]:40691)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sK8jU-0006VU-UF
 for 71639 <at> debbugs.gnu.org; Wed, 19 Jun 2024 23:45:09 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta50.mxroute.com (ZoneMTA) with ESMTPSA id 19033bf734900017a3.001
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 20 Jun 2024 03:45:03 +0000
X-Zone-Loop: 534a636adfb920d101bcf8021eb8f63f05dbae3e4692
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:
 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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8BB1uZw2evg/5aasszsh8WCrM9i8rM5IbKR2pA2UP0E=; b=gdYoeaFuERB9nq9fi1mfeldPZX
 pp+qm34RX8ntJ9nE6Jtek156NFdzYQwFAF8Ci/MSgMKeZDNi0vCdSDADxX5jkRswCTx2jYl2sDXq4
 iAd72n9kRVeTxc9NQgXQ9/zkQyOMTC3Nla4CgIb7+LTq1uZWcegRHsTI49r18xklqC3LLmJDoXwZk
 Gbz84mNfV7mA9ctgKLASsEn+yuDPlqPbAHkZYm79EGBAsU2YBOfHMmeL3MeKWihdkvYNbv8wA678z
 f4fjpp4DB36Osb20D7Qx9i30uPbrwe90rJI+T1tX98nvLTkMcGnkUVLZmSSzwCcMwjzQDhSi6DDdp
 qScNdfgA==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN,
	71639 <at> debbugs.gnu.org
Subject: [PATCH v2 0/5] Improve on restic-backup-service
Date: Wed, 19 Jun 2024 23:44:11 -0400
Message-ID: <cover.1718854920.git.richard@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: Richard Sent <richard@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Some minor adjustments to the WIP version, mostly cleanup and removing some
TODOs that snuck in. Thinking on it there's no need to worry about marking
this as WIP. If it winds up merged earlier than expected I can just submit
another patch series.

Richard Sent (5):
  services: backup: Support bootstrapping an initial restic backup
  services: backup: Add password-command support to restic-service
  services: backup: Add extra-packages field to restic-backup-job
  services: backup: Move restic package to restic-configuration
  tests: Add restic system test.

 doc/guix.texi           |  21 ++++++-
 gnu/services/backup.scm | 129 +++++++++++++++++++++++++++++-----------
 gnu/tests/restic.scm    | 119 ++++++++++++++++++++++++++++++++++++
 3 files changed, 231 insertions(+), 38 deletions(-)
 create mode 100644 gnu/tests/restic.scm


base-commit: e32e3d0a03dc17c4c54a91aad053c9036998b601
-- 
2.45.1





Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:09:37 2024
Received: from localhost ([127.0.0.1]:53641 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJh1F-000333-2c
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:37 -0400
Received: from mail-108-mta97.mxroute.com ([136.175.108.97]:45899)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJh1B-00032f-Ri
 for 71639 <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:34 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta97.mxroute.com (ZoneMTA) with ESMTPSA id 1902d65dda800017a3.002
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:09:29 +0000
X-Zone-Loop: d6e4ff4ee7c9d42ed7e0be8edd2dfc981f196448efac
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:Content-Type:
 MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender
 :Reply-To: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=ndeAEhgOmWt/RWqh6CBSsItSMi5TBX17zPJrwIfAoqQ=; b=qg7kXCfTvw33alVZkjc/qz7c0Z
 0AipGSri43VBoQNwoD4GlA7vKt15qYix6yJXp4X8oWtvxdsszySdxwQTxjU/0LrwH37YES/gLut3Q
 57LLcfdOrpCmlD0ZSsXARsIhBvhjFWaTIBPh9K2rklifTH80/lvnqNlNtXj2Bwd4gCTg8906PGDhf
 Gtl5jxLe9cuNPBVryj7Q3j8e9IOTK0Qom6APEOAGolEpXGMl5dHZMQL+F7qNoU0zQmSt2xwyBpq3B
 PJioooxas+MGZuedMR3iLKxg8MOOkrR4Qk2C7iPR9EEmr0UMWgC2uIJT7MmjA8rX+0t7X8S0An1H1
 zc0pvtVA==;
From: Richard Sent <richard@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: [PATCH WIP 5/5] tests: Add restic system test.
Date: Tue, 18 Jun 2024 18:08:52 -0400
Message-ID: <8efb248a6930d4e82d9f0e1e9cf77369c67780ca.1718747513.git.richard@HIDDEN>
In-Reply-To: <cover.1718747513.git.richard@HIDDEN>
References: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/tests/restic.scm: Create.

Change-Id: Iad5472414c140b133d9b402855bb2f01e96bb0cc
---
 gnu/tests/restic.scm | 124 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 gnu/tests/restic.scm

diff --git a/gnu/tests/restic.scm b/gnu/tests/restic.scm
new file mode 100644
index 0000000000..f8ea76538e
--- /dev/null
+++ b/gnu/tests/restic.scm
@@ -0,0 +1,124 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Richard Sent <richard@HIDDEN>.
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests restic)
+  ;; TODO: Remove what I can from here.
+  #:use-module (gnu bootloader)
+  #:use-module (gnu bootloader grub)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages sync)      ;rclone
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu services)
+  #:use-module (gnu services desktop)
+  #:use-module (gnu services backup)    ;restic
+  #:use-module (gnu services xorg)
+  #:use-module (gnu system)
+  #:use-module (gnu system vm)
+  #:use-module (gnu tests)
+  #:use-module (guix gexp)
+  #:use-module (guix modules)
+  #:use-module (srfi srfi-1)
+  #:export (%test-restic))
+
+(define password "password")
+
+(define password-file
+  (plain-file "password-file" password))
+
+(define password-command
+  (program-file "password-command" #~(display #$password)))
+
+(define (run-restic-test)
+  "Run tests in %restic-os."
+
+  (define os
+    (marionette-operating-system
+     (simple-operating-system (extra-special-file "/root/.restic-test"
+                                                  (plain-file "restic-test"
+                                                              "Hello world!"))
+                              ;; restic-backup-service only takes a string to avoid putting
+                              ;; plaintext entries in the store. Ergo, symlink it.
+                              (extra-special-file "/root/password-file"
+                                                  password-file)
+                              (service restic-backup-service-type
+                                       (restic-backup-configuration
+                                        (jobs
+                                         (list (restic-backup-job
+                                                (name "password-file-backup")
+                                                (repository "/root/restic-password-file-repo")
+                                                (schedule #~'(next-second '(0 15 30 45)))
+                                                (password-file "/root/password-file")
+                                                (files '("/root/.restic-test"))
+                                                (init? #t))
+                                               (restic-backup-job
+                                                (name "password-command-backup")
+                                                (repository "/root/restic-password-command-repo")
+                                                (schedule #~'(next-second '(0 15 30 45)))
+                                                (password-command password-command)
+                                                (files '("/root/.restic-test"))
+                                                (init? #t)))))))
+     #:imported-modules '((gnu services herd)
+                          (guix combinators))))
+
+  (define vm (virtual-machine
+              (operating-system os)
+              ;; TODO: We might be able to lower this.
+              (memory-size 1024)))
+
+  (define test
+    (with-imported-modules (source-module-closure
+                            '((gnu build marionette)))
+      #~(begin
+          (use-modules (gnu build marionette)
+                       (srfi srfi-26)
+                       (srfi srfi-64))
+
+          (let ((marionette (make-marionette (list #$vm))))
+
+            (test-runner-current (system-test-runner #$output))
+            (test-begin "restic")
+
+            (test-assert "backup-file-created"
+              (wait-for-file "/root/.restic-test" marionette))
+
+            (test-assert "mcron running"
+              (marionette-eval
+               '(begin
+                  (use-modules (gnu services herd))
+                  (start-service 'mcron))
+               marionette))
+
+            (test-assert "password-file backup completed"
+              (wait-for-file "/root/restic-password-file-repo/config" marionette
+                             ;; Restic takes a second to run, give it a bit
+                             ;; more time.
+                             #:timeout 20))
+
+            (test-assert "password-comand backup completed"
+              (wait-for-file "/root/restic-password-file-repo/config" marionette
+                             #:timeout 20))
+
+            (test-end)))))
+
+  (gexp->derivation "restic-test" test))
+
+(define %test-restic
+  (system-test
+   (name "restic")
+   (description "Basic tests for the restic service.")
+   (value (run-restic-test))))
-- 
2.45.1





Information forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:09:37 2024
Received: from localhost ([127.0.0.1]:53639 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJh1E-00032z-Gg
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:37 -0400
Received: from mail-108-mta24.mxroute.com ([136.175.108.24]:35981)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJh1B-00032e-VO
 for 71639 <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:34 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta24.mxroute.com (ZoneMTA) with ESMTPSA id 1902d65d4ed00017a3.002
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:09:26 +0000
X-Zone-Loop: b0f797caa8b26b55f62ccc43adef6761ab86e5f6f5c1
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=PKqw4pzLvQWWJgeYjeiLEkGEn5gc6aE57W3QVB6MVzE=; b=lsqZl3daCbP2iR3NSryfK1JdwY
 RYqXKX/iGhu4p5/PZuYobhcabuspZIioL9wR4M6JVWs92FeSdALOK4pC5n4GzDXT7of0Z+UZMBOR8
 gpbJwUZHOZ9oqDpK/vqlNFaQPcOOa/0XAW8caOtwb8wjTy/o501XZtvRH66Z9vSHN2SkoevulZrcx
 fPYQWUNjBuRO5/UidI9j7px+8U8Vxko0HaDs9mFbOAMpFnwrYlYMmUBO/hmtBDMKLBZgKMdaF/7/r
 Eg+L2m9Snblu9zIhoaEYHZ+vQ47nJs02JKX/shEpHt3duED73PNmuVAYTKrCZ/sL6nYbp7ETfTTpJ
 2o/XkEKA==;
From: Richard Sent <richard@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: [PATCH WIP 4/5] services: backup: Move restic package to
 restic-configuration
Date: Tue, 18 Jun 2024 18:08:51 -0400
Message-ID: <7749ca0f06a80cf9accd24dc62fa8896cd35625d.1718747513.git.richard@HIDDEN>
In-Reply-To: <cover.1718747513.git.richard@HIDDEN>
References: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* 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 a6d8404a5a..a59cf08c71 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
@@ -143,7 +144,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
@@ -191,7 +192,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
@@ -199,7 +200,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
@@ -242,13 +243,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"))))
@@ -260,16 +261,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





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:09:32 2024
Received: from localhost ([127.0.0.1]:53635 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJh19-00032Q-VW
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:32 -0400
Received: from mail-108-mta96.mxroute.com ([136.175.108.96]:35687)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJh17-000325-NN
 for 71639 <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:30 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta96.mxroute.com (ZoneMTA) with ESMTPSA id 1902d65c5af00017a3.002
 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:09:22 +0000
X-Zone-Loop: a6785a6d9facb99f9f55f23f5b5a0967bfa001671860
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=GRgk0YcfdnOlUM8vrZVXJwP2dkp9Z6VwaR5wZrbFuEI=; b=HW7eneh+kLX+dCqaomvyOr+SH9
 LuOm19xVZUWxPIp1dJjUqFhYxHH/Qgpgefp3+0xsXWJGQ/io8DcWL7h9nNtTNP47dX3mWWN6Gl6rN
 /3RJaul5Dj8WU3ftYrpCBqZxhnlXHPKH8J4esc7oLDis5zfhkf4zSbZ68tBR7tUx9sqRwHDiT2VBI
 PuEJXzgYWKR/sWfAnSrG1Uo8lvWrw4KHKGZcM/M8CIXQp+z34mE2KmdTi2wn8D4Q11p0xHEFn3Kd7
 lKJhNch1Eakcsx1p6v0Qk3d+s5wsxMsFWOBVGFX/Czxq01stNfhl1M40yEilobDtOlNf929TvZ5Oy
 RMFJYwfw==;
From: Richard Sent <richard@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: [PATCH WIP 2/5] services: backup: Add password-command support to
 restic-service
Date: Tue, 18 Jun 2024 18:08:49 -0400
Message-ID: <388adecd6bae7d959392b862f1ccc234c0c24a6d.1718747513.git.richard@HIDDEN>
In-Reply-To: <cover.1718747513.git.richard@HIDDEN>
References: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm (restic-backup-job): Add password-command.
(verify-restic-backup-job-configuration): Create.
(restic-backup-job-program): Set either RESTIC_PASSWORD or
RESTIC_PASSWORD_COMMAND depending on what is configured.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: Ice9cf85d1ee4485a2737f515c63c969918219df0
---
 doc/guix.texi           |  7 +++++++
 gnu/services/backup.scm | 42 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 63c9cbd1a7..f22d679023 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41344,6 +41344,13 @@ Miscellaneous Services
 that will be used to set the @env{RESTIC_PASSWORD} environment variable
 for the current job.
 
+@item @code{password-command} (type: file-like)
+String path or file-like object representing the executable file that
+prints password to stdout.  If a file-like object is used, it is placed
+in the store globally executable and in plain text.  The executable
+should be designed such that it does not compromise the password if an
+unauthorized user runs it.
+
 @item @code{schedule} (type: gexp-or-string)
 A string or a gexp that will be passed as time specification in the
 mcron job specification (@pxref{Syntax, mcron job specifications,,
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index eeef11eae7..2471d0ea7b 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -66,6 +66,9 @@ (define (lowerable? value)
 (define list-of-lowerables?
   (list-of lowerable?))
 
+(define-maybe/no-serialization string)
+(define-maybe/no-serialization file-like)
+
 (define-configuration/no-serialization restic-backup-job
   (restic
    (package restic)
@@ -80,10 +83,16 @@ (define-configuration/no-serialization restic-backup-job
    (string)
    "The restic repository target of this job.")
   (password-file
-   (string)
+   (maybe-string)
    "Name of the password file, readable by the configured @code{user}, that
 will be used to set the @code{RESTIC_PASSWORD} environment variable for the
 current job.")
+  (password-command
+   (maybe-file-like)
+   "Name of the password command that, when run, returns the password over
+stdin. Due to the nature of the store this command will be globally executable
+and should have external protections to ensure other users cannot retrieve the
+password. This overrides password-file.")
   (schedule
    (gexp-or-string)
    "A string or a gexp that will be passed as time specification in the mcron
@@ -104,6 +113,14 @@ (define-configuration/no-serialization restic-backup-job
    "A list of values that are lowered to strings.  These will be passed as
 command-line arguments to the current job @command{restic backup} invokation."))
 
+(define (verify-restic-backup-job-configuration config)
+  (unless (or (maybe-value-set? (restic-backup-job-password-file config))
+              (maybe-value-set? (restic-backup-job-password-command config)))
+    (error "either password-file or password-command must be configured."))
+  (when (and (maybe-value-set? (restic-backup-job-password-file config))
+             (maybe-value-set? (restic-backup-job-password-command config)))
+    (error "password-file and password-command can not be configured simultaneously.")))
+
 (define list-of-restic-backup-jobs?
   (list-of restic-backup-job?))
 
@@ -113,12 +130,22 @@ (define-configuration/no-serialization restic-backup-configuration
    "The list of backup jobs for the current system."))
 
 (define (restic-backup-job-program config)
+  (define (maybe-value-or-false maybe)
+    (if (maybe-value-set? maybe)
+        maybe
+        #f))
+
+  ;; TODO: Find a place to also verify restic-backup-configuration. Mainly that jobs >=1
+  (verify-restic-backup-job-configuration config)
+
   (let ((restic
          (file-append (restic-backup-job-restic config) "/bin/restic"))
         (repository
          (restic-backup-job-repository config))
         (password-file
-         (restic-backup-job-password-file config))
+         (maybe-value-or-false (restic-backup-job-password-file config)))
+        (password-command
+         (maybe-value-or-false (restic-backup-job-password-command config)))
         (files
          (restic-backup-job-files config))
         (extra-flags
@@ -134,9 +161,14 @@ (define (restic-backup-job-program config)
      #~(begin
          (use-modules (ice-9 popen)
                       (ice-9 rdelim))
-         (setenv "RESTIC_PASSWORD"
-                 (with-input-from-file #$password-file read-line))
-
+         (or (and=> #$password-file (lambda (x)
+                                      (setenv "RESTIC_PASSWORD"
+                                              (with-input-from-file x read-line))))
+             (and=> #$password-command (lambda (x)
+                                         (setenv "RESTIC_PASSWORD_COMMAND" x)))
+             ;; Have a backup error message in case
+             ;; verify-restic-backup-job-configuration is messed with
+             (error "Neither password-file or password-command set"))
          (when #$init?
            ;; Check if the repository exists. See
            ;; https://github.com/restic/restic/issues/1690 and
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:09:32 2024
Received: from localhost ([127.0.0.1]:53633 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJh19-00032M-8d
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:31 -0400
Received: from mail-108-mta114.mxroute.com ([136.175.108.114]:46741)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJh17-000326-T6
 for 71639 <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:30 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta114.mxroute.com (ZoneMTA) with ESMTPSA id
 1902d65cb7500017a3.002 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:09:24 +0000
X-Zone-Loop: e96ab436a84f242ce19376eba8c7f147e44e6d00a06e
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=Kp6UdaLafZCtMHopLCdbgRcFxUwyYsOPiJ26k1B1Afw=; b=SpgcITsdGm3r5gcBqaOitpwRi2
 /8gtq6NnK8WTQLLOfF0Xg4d4WxYZDEC/J6PhAoMrhvDiub3k0YC+czTk+7ao3Si0EmZ9vPTP0AGid
 mx6slmzgS73OnbqWhL92Y9jUCJhaWZWk5hubvdZJlNu4CFeuxIQRzR++jhOUUuoHA+PtmHNOz5oZP
 XwNkbU+AKJiH4Y3gS4ECjC/4HTRqE7PAO42u7AsP/9rhM2Cv+ypsdbolt7yFLWDUwIyPllFGs9vyM
 1Zj0Ftx2OFtedJ7JYxMup/M4DHxQWMDR39VkDfiSHFVOX2o7ogA6RGqV6UkQbowdz56/MJIRHr88c
 +NGOyytQ==;
From: Richard Sent <richard@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: [PATCH WIP 3/5] services: backup: Add extra-packages field to
 restic-backup-job
Date: Tue, 18 Jun 2024 18:08:50 -0400
Message-ID: <146d362c149771810d673e927b56d3ec44bc9bba.1718747513.git.richard@HIDDEN>
In-Reply-To: <cover.1718747513.git.richard@HIDDEN>
References: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm (restic-backup-job): Create extra-packages.
(restic-guix-wrapper-package): Add the extra-packages field of every job as
inputs.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: I4f0b070bc6dc895553ba69256d14e45898291c02
---
 doc/guix.texi           |  4 ++++
 gnu/services/backup.scm | 33 ++++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f22d679023..32ce0c86b9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41367,6 +41367,10 @@ Miscellaneous Services
 @item @code{verbose?} (default: @code{#f}) (type: boolean)
 Whether to enable verbose output for the current backup job.
 
+@item @code{extra-packages} (default: @code{'()} (type: list-of-packages)
+The list of extra packages needed for restic to run the current backup
+job.
+
 @item @code{extra-flags} (default: @code{'()}) (type: list-of-lowerables)
 A list of values that are lowered to strings.  These will be passed as
 command-line arguments to the current job @command{restic backup}
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index 2471d0ea7b..a6d8404a5a 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -41,6 +41,7 @@ (define-module (gnu services backup)
             restic-backup-job-files
             restic-backup-job-init?
             restic-backup-job-verbose?
+            restic-backup-job-extra-packages
             restic-backup-job-extra-flags
 
             restic-backup-configuration
@@ -102,6 +103,9 @@ (define-configuration/no-serialization restic-backup-job
    (list-of-lowerables '())
    "The list of files or directories to be backed up.  It must be a list of
 values that can be lowered to strings.")
+  (extra-packages
+   (list-of-packages '())
+   "The list of extra packages needed for restic to run this backup job.")
   (verbose?
    (boolean #f)
    "Whether to enable verbose output for the current backup job.")
@@ -239,22 +243,25 @@ (define (restic-backup-job->mcron-job config)
            #:user #$user)))
 
 (define (restic-guix-wrapper-package jobs)
-  (package
-    (name "restic-backup-service-wrapper")
-    (version "0.0.0")
-    (source (restic-guix jobs))
-    (build-system copy-build-system)
-    (arguments
-     (list #:install-plan #~'(("./" "/bin"))))
-    (home-page "https://restic.net")
-    (synopsis
-     "Easily interact from the CLI with Guix configured backups")
-    (description
-     "This package provides a simple wrapper around @code{restic}, handled
+  (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))
+      (build-system copy-build-system)
+      (arguments
+       (list #:install-plan #~'(("./" "/bin"))))
+      (home-page "https://restic.net")
+      (synopsis
+       "Easily interact from the CLI with Guix configured backups")
+      (description
+       "This package provides a simple wrapper around @code{restic}, handled
 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.")
-    (license license:gpl3+)))
+      (inputs extra-packages)
+      (license license:gpl3+))))
 
 (define restic-backup-service-profile
   (lambda (config)
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at 71639 <at> debbugs.gnu.org:


Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:09:27 2024
Received: from localhost ([127.0.0.1]:53627 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJh14-00031t-IH
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:27 -0400
Received: from mail-108-mta227.mxroute.com ([136.175.108.227]:36689)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJh12-00031l-0F
 for 71639 <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:09:24 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta227.mxroute.com (ZoneMTA) with ESMTPSA id
 1902d65b3e000017a3.002 for <71639 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:09:18 +0000
X-Zone-Loop: e7f3684c7a8d6b45121dcd13de1489fab24eddf7d436
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:Content-Type:
 MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender
 :Reply-To: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=mGC2u6AkPdw2TbKu3XSwToUFXRtmupACwqHDC9DtPuE=; b=eV5Ue2TnPuO+JHRwbrXr/VQmLF
 ukS/9YfAVuLqWFpn5Ac29ZGLUjVZv2AoZ5WIpc68esYPNme+Hq0I3dypmC4qSrQasl3+QVgStwUfa
 mE/hzPE1+tFFhXwGUZ7EAMxfHjaekou0CeytVcyV/Xg7fGkxczFFWwZCJlSSd3k5tVeYwoA8fuUeS
 g5I/9VxP42F+E5R35uUTtLDjR3B+dKS58ldVg4tzLP0T+OimGLbotKO4s7YSGqcVp/C1F6ySULUzE
 PWVGgLZDxjz+woKI/5/fouusJ6+Ovo+bgbiDiiiluRAef9fwmBrFgfG1AHiaXcYYLsOUkSAgb1BaC
 7WU0YWNg==;
From: Richard Sent <richard@HIDDEN>
To: 71639 <at> debbugs.gnu.org
Subject: [PATCH WIP 1/5] services: backup: Support bootstrapping an initial
 restic backup
Date: Tue, 18 Jun 2024 18:08:48 -0400
Message-ID: <88ce7267a59dfb3d80bd790e99b00a731e56835f.1718747513.git.richard@HIDDEN>
In-Reply-To: <cover.1718747513.git.richard@HIDDEN>
References: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Florian Pelz <pelzflorian@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Matthew Trzcinski <matt@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71639
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/backup.scm: (restic-backup-job): Add init? field.
(restic-backup-job-program): Initialize repository if init? is set and
repository does not already exist.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: I71d0cbaac646b9d160e662b69286f229b9a9f64d
---
 doc/guix.texi           |  4 ++++
 gnu/services/backup.scm | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 0102fd0fad..63c9cbd1a7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41353,6 +41353,10 @@ Miscellaneous Services
 The list of files or directories to be backed up.  It must be a list of
 values that can be lowered to strings.
 
+@item @code{init?} (default: @code{#f}) (type: boolean)
+Whether restic-backup-service should check and (if it does not exist)
+initialize the repository before running the backup.
+
 @item @code{verbose?} (default: @code{#f}) (type: boolean)
 Whether to enable verbose output for the current backup job.
 
diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm
index 555e9fc959..eeef11eae7 100644
--- a/gnu/services/backup.scm
+++ b/gnu/services/backup.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@HIDDEN>
+;;; Copyright © 2024 Richard Sent <richard@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,7 @@ (define-module (gnu services backup)
             restic-backup-job-password-file
             restic-backup-job-schedule
             restic-backup-job-files
+            restic-backup-job-init?
             restic-backup-job-verbose?
             restic-backup-job-extra-flags
 
@@ -94,6 +96,9 @@ (define-configuration/no-serialization restic-backup-job
   (verbose?
    (boolean #f)
    "Whether to enable verbose output for the current backup job.")
+  (init?
+   (boolean #f)
+   "Whether to attempt to initialize a new repository for automated bootstrap purposes.")
   (extra-flags
    (list-of-lowerables '())
    "A list of values that are lowered to strings.  These will be passed as
@@ -118,6 +123,8 @@ (define (restic-backup-job-program config)
          (restic-backup-job-files config))
         (extra-flags
          (restic-backup-job-extra-flags config))
+        (init?
+         (restic-backup-job-init? config))
         (verbose
          (if (restic-backup-job-verbose? config)
              '("--verbose")
@@ -130,6 +137,19 @@ (define (restic-backup-job-program config)
          (setenv "RESTIC_PASSWORD"
                  (with-input-from-file #$password-file read-line))
 
+         (when #$init?
+           ;; Check if the repository exists. See
+           ;; https://github.com/restic/restic/issues/1690 and
+           ;; https://github.com/NixOS/nixpkgs/pull/307962.
+           ;;
+           ;; XXX: restic returns values other than 1 on failure. Use
+           ;; unless EXIT_SUCCESS instead of when EXIT_FAILURE.
+           (unless (equal? EXIT_SUCCESS (system* #$restic "cat" "config"
+                                               "-r" #$repository))
+             ;; Initialize it.
+             (unless (equal? EXIT_SUCCESS (system* #$restic "init"
+                                                 "-r" #$repository))
+               (error "Failed to initialize restic repository: " #$repository))))
          (execlp #$restic #$restic #$@verbose
                  "-r" #$repository
                  #$@extra-flags
-- 
2.45.1





Information forwarded to pelzflorian@HIDDEN, ludo@HIDDEN, matt@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jun 2024 22:07:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 18:07:43 2024
Received: from localhost ([127.0.0.1]:53570 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJgzP-0002xB-0t
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:07:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:35620)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1sJgzN-0002x3-C8
 for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 18:07:42 -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 <richard@HIDDEN>)
 id 1sJgzK-0003Mu-7m
 for guix-patches@HIDDEN; Tue, 18 Jun 2024 18:07:38 -0400
Received: from mail-108-mta195.mxroute.com ([136.175.108.195])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <richard@HIDDEN>)
 id 1sJgzI-0002Yd-7S
 for guix-patches@HIDDEN; Tue, 18 Jun 2024 18:07:37 -0400
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id
 1902d640dc100017a3.002 for <guix-patches@HIDDEN>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 18 Jun 2024 22:07:30 +0000
X-Zone-Loop: 6711eaba758ab41ff3c9968e498f796cb14218e7d8cf
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:
 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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=iwDCiCs+dK8y88FPWQJfX7kqlGbI2i7OWnVnHH8ZO28=; b=Lb7IbzNz/ewgTEyyNib9Gmpd4V
 Ivcs8bRzdLdar+I0Kiyda1zAaA95KjfphYPxteiS41dSRow7NysP2yD22aFXEZCBGI+4LsYhZfknH
 QBm5IIufCkLjATsEyAcgghEAiY0QWA1c2zIC1CpKvixm8H0orSm9kl12/DeH9tixy01o1Z53U52XH
 IyuVJNcFMIJIkLAcYtFtC1k2RmQ8uV5hr/GKQVmYTLJFTXYmmaDxrKrOcZvC3uNkr/tFGSwM0Qj4W
 4JVL86koFgeYOtq0A/YRfOnj/SQx+ObP1aEvX/cZ2FSMRg1g+tGQj9+XPD6HGXUGj88813In2TqAU
 bVseFRAw==;
From: Richard Sent <richard@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH WIP 0/5] Improve on restic-backup-service
Date: Tue, 18 Jun 2024 18:06:39 -0400
Message-ID: <cover.1718747513.git.richard@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Authenticated-Id: richard@HIDDEN
Received-SPF: pass client-ip=136.175.108.195;
 envelope-from=richard@HIDDEN; helo=mail-108-mta195.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-Debbugs-Envelope-To: submit
Cc: ludo@HIDDEN, Richard Sent <richard@HIDDEN>,
 goodoldpaul@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Hi all!

This is the previously promised [1] patch series relating to
restic-backup-service. The highlights:

1. init? was added that bootstraps a new backup.

2. RESTIC_PASSWORD_COMMAND support.

3. Add extra-packages field for jobs.

4. Move restic from restic-backup-job to restic-backup-configuration.

5. Add a basic system-level test suite.

Regarding 4, the previous way felt a bit orthogonal to how services of a
similar nature work. (For example, you don't specify an mcron package for
every job.) I can't think of a use case for mixing-and-matching restic
packages with different jobs. If there is a reason, I think a good compromise
would be a "restic-override" job field.

I'm marking this as WIP because there are a couple more things I want to
investigate, but it feels complete enough to submit for feedback. My main
point of interest is what can be done to improve support for Restic's other
backends, see [2]. I imagine 0.9.6 only supports a subset of those, but still.

In my dream world we could combine this patch with an upgrade to the restic
package itself (which, among other things, supports compression). I asked the
developers about (re)including a vendor directory in their tarball but haven't
heard back [3]. Perhaps this service can spark some action on an old Guix
tracking issue [4].

[1]: https://issues.guix.gnu.org/69513#7
[2]: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html
[3]: https://github.com/restic/restic/issues/3945#issuecomment-2141090355
[4]: https://issues.guix.gnu.org/63019

Richard Sent (5):
  services: backup: Support bootstrapping an initial restic backup
  services: backup: Add password-command support to restic-service
  services: backup: Add extra-packages field to restic-backup-job
  services: backup: Move restic package to restic-configuration
  tests: Add restic system test.

 doc/guix.texi           |  21 ++++++-
 gnu/services/backup.scm | 131 +++++++++++++++++++++++++++++-----------
 gnu/tests/restic.scm    | 124 +++++++++++++++++++++++++++++++++++++
 3 files changed, 238 insertions(+), 38 deletions(-)
 create mode 100644 gnu/tests/restic.scm


base-commit: a575d0f5d5322bac977423b6bd2742c8dc5a14a6
-- 
2.45.1





Acknowledgement sent to Richard Sent <richard@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#71639; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.