From patchwork Sat May 17 15:09:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: paul X-Patchwork-Id: 42655 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C017C27BC4A; Sat, 17 May 2025 16:11:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9F09D27BC49 for ; Sat, 17 May 2025 16:11:17 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uGJBv-000085-UQ; Sat, 17 May 2025 11:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uGJBs-00007t-Ja for guix-patches@gnu.org; Sat, 17 May 2025 11:11:08 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGJBs-0007hS-7q; Sat, 17 May 2025 11:11:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=yvo5Ja/CaxQI4sbz376Q6L3v7VUXf6Xk9rsCU5zJ7LQ=; b=hWMyM5VmAWvZeKDJaXur0m/ki20YOU7kZjwtp1ectJPfazTVtrfuYA+W0VazPwHo6P26LGzoqfnvr5uECT1ljN4nTBVJjSeMJqymw9G+033AwutaGwmiWWQAK4W8qgs4MRolecQ7d7B/HMOrTVzCV6WyNlowRe3Zve4FpyLT++ZiTrxlKkJfFt1gzu3eza10tDOVFg8+YGA/1adMF5faUISYz3+JBms+b/i2Y2IhNXxBvmPsBnQJtmceIjHD8Xq0ZjNfffu+jIZ8dNiHCua/DgFaB/btobaiqFF0N4u+EJvGfk/lvWkq1VWr3U2drY2BQQb51jgDwmxsSVQqMtyrfw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uGJBm-0004Yc-33; Sat, 17 May 2025 11:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#76169] [PATCH v9] home: Add home-restic-backup service. References: <76d82b80-722b-46de-8791-d6a19def8c85@autistici.org> In-Reply-To: <76d82b80-722b-46de-8791-d6a19def8c85@autistici.org> Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, gabriel@erlikon.ch, hako@ultrarare.space, janneke@gnu.org, ludo@gnu.org, maxim.cournoyer@gmail.com, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Sat, 17 May 2025 15:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76169 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo To: 76169@debbugs.gnu.org Cc: Giacomo Leidi , Andrew Tropin , Gabriel Wicki , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour X-Debbugs-Original-Xcc: Andrew Tropin , Gabriel Wicki , Hilton Chain , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour Received: via spool by 76169-submit@debbugs.gnu.org id=B76169.174749463017443 (code B ref 76169); Sat, 17 May 2025 15:11:02 +0000 Received: (at 76169) by debbugs.gnu.org; 17 May 2025 15:10:30 +0000 Received: from localhost ([127.0.0.1]:49790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGJBF-0004XG-AC for submit@debbugs.gnu.org; Sat, 17 May 2025 11:10:30 -0400 Received: from confino.investici.org ([2a11:7980:1::2:0]:46693) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uGJBB-0004Wj-4F for 76169@debbugs.gnu.org; Sat, 17 May 2025 11:10:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1747494624; bh=yvo5Ja/CaxQI4sbz376Q6L3v7VUXf6Xk9rsCU5zJ7LQ=; h=From:To:Cc:Subject:Date:From; b=TzWQBtSOy9MHHTc5K8ImM/FYGCdm+2Ae4kAuIAvxHd9Ukf+UXKYaMoo20dZ0yvQOs ktr/Rbq2si/Bf9fIGzVACEmGSjcV3L2Cywcx4ey+dMkFodrQUbGvy3SI+h5zQxRf5z P89DXw41AMD2GKzzCHdyLS/LXbW2hM7DBRJ2gW8s= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4b06nr1pHjz11Kh; Sat, 17 May 2025 15:10:24 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4b06nr0bLCz11Hq; Sat, 17 May 2025 15:10:24 +0000 (UTC) Date: Sat, 17 May 2025 17:09:54 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches X-Patchwork-Original-From: Giacomo Leidi via Guix-patches via From: paul Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/backup.scm: Drop mcron obsolete export. (restic-backup-job-program): Generalize to restic-program. (lower-restic-backup-job): New procedure implementing a standard way to lower restic-backup-job records into lists. (restic-program): Implement general way to run restic commands, for example to initialize repositories. (restic-backup-configuration): Reimplement with (guix records). (restic-backup-job-{logfile,command,requirement,modules}): Add new procedures and add support for Guix Home environments. (restic-backup-job->shepherd-service): Add support for Guix Home environments. (restic-backup-service-activation): Drop procedure as now the Shepherd takes care of creating timers log file directories. (restic-backup-service-type): Drop profile and activation services extensions. * gnu/home/services/backup.scm: New file. * gnu/local.mk: Add this. * doc/guix.texi: Document this. Change-Id: Ied1c0a5756b715fba176a0e42ea154246089e6be --- doc/guix.texi | 82 ++++++++++++++- gnu/home/services/backup.scm | 38 +++++++ gnu/local.mk | 1 + gnu/services/backup.scm | 187 +++++++++++++++++++++++------------ 4 files changed, 243 insertions(+), 65 deletions(-) create mode 100644 gnu/home/services/backup.scm base-commit: 9f3d8dbda60bb1dd15d2956c334354947df8b3f5 diff --git a/doc/guix.texi b/doc/guix.texi index 8e73685a216..98a9ed573aa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -466,6 +466,7 @@ Top * GPG: GNU Privacy Guard. Setting up GPG and related tools. * Desktop: Desktop Home Services. Services for graphical environments. * Guix: Guix Home Services. Services for Guix. +* Backup: Backup Home Services. Services for backing up User's files. * Fonts: Fonts Home Services. Services for managing User's fonts. * Sound: Sound Home Services. Dealing with audio. * Mail: Mail Home Services. Services for managing mail. @@ -44895,7 +44896,8 @@ Miscellaneous Services @item @code{log-file} (type: maybe-string) The file system path to the log file for this job. By default the file will have be @file{/var/log/restic-backup/@var{job-name}.log}, where @var{job-name} is the -name defined in the @code{name} field. +name defined in the @code{name} field. For Guix Home services it defaults to +@file{$XDG_STATE_HOME/shepherd/restic-backup/@var{job-name}.log}. @item @code{max-duration} (type: maybe-number) The maximum duration in seconds that a job may last. Past @@ -44922,8 +44924,10 @@ Miscellaneous Services evaluate to @code{calendar-event} records or to strings. Strings must contain Vixie cron date lines. -@item @code{requirement} (default: @code{'()}) (type: list-of-symbols) -The list of Shepherd services that this backup job depends upon. +@item @code{requirement} (type: maybe-list-of-symbols) +The list of Shepherd services that this backup job depends upon. When unset it +defaults to @code{'()}, for Guix Home. Otherwise to +@code{'(user-processes file-systems)}. @item @code{files} (default: @code{'()}) (type: list-of-lowerables) The list of files or directories to be backed up. It must be a list of @@ -48824,6 +48828,7 @@ Home Services * GPG: GNU Privacy Guard. Setting up GPG and related tools. * Desktop: Desktop Home Services. Services for graphical environments. * Guix: Guix Home Services. Services for Guix. +* Backup: Backup Home Services. Services for backing up User's files. * Fonts: Fonts Home Services. Services for managing User's fonts. * Sound: Sound Home Services. Dealing with audio. * Mail: Mail Home Services. Services for managing mail. @@ -50414,6 +50419,77 @@ Guix Home Services @end lisp @end defvar +@node Backup Home Services +@subsection Backup Services + +The @code{(gnu home services backup)} module offers services for backing up +file system trees. For now, it provides the @code{home-restic-backup-service-type}. + +With @code{home-restic-backup-service-type}, you can periodically back up +directories and files with @uref{https://restic.net/, Restic}, which +supports end-to-end encryption and deduplication. Consider the +following configuration: + +@lisp +(use-modules (gnu home services backup) ;for 'restic-backup-job', 'home-restic-backup-service-type' + (gnu packages sync) ;for 'rclone' + @dots{}) + +(home-environment + + (packages (list rclone ;for use by restic + @dots{})) + (services + (list + @dots{} + (simple-service 'backup-jobs + home-restic-backup-service-type + (list (restic-backup-job + (name "remote-ftp") + (repository "rclone:remote-ftp:backup/restic") + (password-file "/home/alice/.restic") + ;; Every day at 23. + (schedule "0 23 * * *") + (files '("/home/alice/.restic" + "/home/alice/.config/rclone" + "/home/alice/Pictures")))))))) +@end lisp + +In general it is preferrable to extend the @code{home-restic-backup-service-type}, +as shown in the example above. This is because it takes care of wrapping everything +with @code{for-home}, which enables the @code{home-restic-backup-service-type} and +@code{restic-backup-service-type} to share the same codebase. + +For a custom configuration, wrap your @code{restic-backup-configuration} in +@code{for-home}, as in this example: + +@lisp +(use-modules (gnu services) ;for 'for-home' + (gnu services backup) ;for 'restic-backup-job' and 'restic-backup-configuration' + (gnu home services backup) ;for 'home-restic-backup-service-type' + (gnu packages sync) ;for 'rclone' + @dots{}) + +(home-environment + + (packages (list rclone ;for use by restic + @dots{})) + (services + (list + @dots{} + (service home-restic-backup-service-type + (for-home + (restic-backup-configuration + (jobs (list @dots{})))))))) +@end lisp + +You can refer to @pxref{Miscellaneous Services, +@code{restic-backup-service-type}} for details about +@code{restic-backup-configuration} and @code{restic-backup-job}. +The only difference is that the @code{home-restic-backup-service-type} +will ignore the @code{user} and @code{group} field of +@code{restic-backup-job}. + @node Fonts Home Services @subsection Fonts Home Services diff --git a/gnu/home/services/backup.scm b/gnu/home/services/backup.scm new file mode 100644 index 00000000000..ac977f835b6 --- /dev/null +++ b/gnu/home/services/backup.scm @@ -0,0 +1,38 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Giacomo Leidi +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu home services backup) + #:use-module (gnu services) + #:use-module (gnu services backup) + #:use-module (gnu home services) + #:use-module (gnu home services shepherd) + #:export (home-restic-backup-service-type) + #:re-export (restic-backup-configuration + restic-backup-job)) + +(define home-restic-backup-service-type + (service-type + (inherit (system->home-service-type restic-backup-service-type)) + (extend + (lambda (config jobs) + (for-home + (restic-backup-configuration + (inherit config) + (jobs (append (restic-backup-configuration-jobs config) + jobs)))))) + (default-value (for-home (restic-backup-configuration))))) diff --git a/gnu/local.mk b/gnu/local.mk index dfafe8b8953..7311c33f0f6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -103,6 +103,7 @@ GNU_SYSTEM_MODULES = \ %D%/home.scm \ %D%/home/services.scm \ %D%/home/services/admin.scm \ + %D%/home/services/backup.scm \ %D%/home/services/desktop.scm \ %D%/home/services/dict.scm \ %D%/home/services/dotfiles.scm \ diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index 6e066bd3d66..8fdf9ce902f 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -28,6 +28,7 @@ (define-module (gnu services backup) #:prefix license:) #:use-module (guix modules) #:use-module (guix packages) + #:use-module (guix records) #:use-module (srfi srfi-1) #:export (restic-backup-job restic-backup-job? @@ -47,16 +48,21 @@ (define-module (gnu services backup) restic-backup-job-verbose? restic-backup-job-extra-flags + lower-restic-backup-job + restic-backup-configuration restic-backup-configuration? - restic-backup-configuration-fields restic-backup-configuration-jobs restic-backup-job-program - restic-backup-job->mcron-job + restic-backup-job->shepherd-service restic-guix restic-guix-wrapper-package restic-backup-service-profile + restic-program + restic-job-log-file + restic-backup-job-command + restic-backup-job-modules restic-backup-service-type)) (define (gexp-or-string? value) @@ -75,6 +81,8 @@ (define list-of-symbols? (define-maybe/no-serialization string) (define-maybe/no-serialization number) +(define-maybe/no-serialization symbol) +(define-maybe/no-serialization list-of-symbols) (define-configuration/no-serialization restic-backup-job (restic @@ -90,7 +98,8 @@ (define-configuration/no-serialization restic-backup-job (maybe-string) "The file system path to the log file for this job. By default the file will have be @file{/var/log/restic-backup/@var{job-name}.log}, where @var{job-name} is the -name defined in the @code{name} field.") +name defined in the @code{name} field. For Guix Home services it defaults to +@file{$XDG_STATE_HOME/shepherd/restic-backup/@var{job-name}.log}.") (max-duration (maybe-number) "The maximum duration in seconds that a job may last. Past @@ -117,8 +126,10 @@ (define-configuration/no-serialization restic-backup-job evaluate to @code{calendar-event} records or to strings. Strings must contain Vixie cron date lines.") (requirement - (list-of-symbols '()) - "The list of Shepherd services that this backup job depends upon.") + (maybe-list-of-symbols) + "The list of Shepherd services that this backup job depends upon. When unset it +defaults to @code{'()}, for Guix Home. Otherwise to +@code{'(user-processes file-systems)}.") (files (list-of-lowerables '()) "The list of files or directories to be backed up. It must be a list of @@ -131,15 +142,20 @@ (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} invocation.")) -(define list-of-restic-backup-jobs? - (list-of restic-backup-job?)) +;; (for-home (restic-backup-configuration ...)) is not able to replace for-home? with #t, +;; pk prints #f. Once for-home will be able to work with (gnu services configuration) the +;; record can be migrated back to define-configuration. +(define-record-type* + restic-backup-configuration + make-restic-backup-configuration + restic-backup-configuration? + this-restic-backup-configuration -(define-configuration/no-serialization restic-backup-configuration - (jobs - (list-of-restic-backup-jobs '()) - "The list of backup jobs for the current system.")) + (jobs restic-backup-configuration-jobs (default '())) ; list of restic-backup-job + (home-service? restic-backup-configuration-home-service? + (default for-home?) (innate))) -(define (restic-backup-job-program config) +(define (lower-restic-backup-job config) (let ((restic (file-append (restic-backup-job-restic config) "/bin/restic")) (repository @@ -150,22 +166,42 @@ (define (restic-backup-job-program config) (restic-backup-job-files config)) (extra-flags (restic-backup-job-extra-flags config)) - (verbose + (verbose? (if (restic-backup-job-verbose? config) '("--verbose") '()))) - (program-file - "restic-backup-job.scm" - #~(begin - (use-modules (ice-9 popen) - (ice-9 rdelim)) - (setenv "RESTIC_PASSWORD" - (with-input-from-file #$password-file read-line)) - - (execlp #$restic #$restic #$@verbose - "-r" #$repository - #$@extra-flags - "backup" #$@files))))) + #~(list (list #$@files) #$restic #$repository #$password-file + (list #$@verbose?) (list #$@extra-flags)))) + +(define restic-program + #~(lambda (action action-args job-restic repository password-file verbose? extra-flags) + (use-modules (ice-9 format)) + ;; This can be extended later, i.e. to have a + ;; centrally defined restic package. + ;; See https://issues.guix.gnu.org/71639 + (define restic job-restic) + + (define command + `(,restic ,@verbose? + "-r" ,repository + ,@extra-flags + ,action ,@action-args)) + + (setenv "RESTIC_PASSWORD_FILE" password-file) + + (when (> (length verbose?) 0) + (format #t "Running~{ ~a~}~%" command)) + + (apply execlp `(,restic ,@command)))) + +(define (restic-backup-job-program config) + (program-file + "restic-backup" + #~(let ((restic-exec + #$restic-program) + (job #$(lower-restic-backup-job config))) + + (apply restic-exec `("backup" ,@job))))) (define (restic-guix jobs) (program-file @@ -207,55 +243,89 @@ (define (restic-guix jobs) (main (command-line))))) -(define (restic-job-log-file job) +(define* (restic-job-log-file job #:key (home-service? #f)) (let ((name (restic-backup-job-name job)) (log-file (restic-backup-job-log-file job))) (if (maybe-value-set? log-file) log-file - (string-append "/var/log/restic-backup/" name ".log")))) + (if home-service? + #~(begin + (use-modules (shepherd support)) + (string-append %user-log-dir "/restic-backup/" #$name ".log")) + (string-append "/var/log/restic-backup/" name ".log"))))) + +(define* (restic-backup-job-command name files #:key (home-service? #f)) + (if home-service? + #~(list + "restic-guix" "backup" #$name) + ;; We go through bash, instead of executing + ;; restic-guix directly, because the login shell + ;; gives us the correct user environment that some + ;; backends require, such as rclone. + #~(list + (string-append #$bash-minimal "/bin/bash") + "-l" "-c" + (string-append "restic-guix backup " #$name)))) -(define (restic-backup-job->shepherd-service config) +(define* (restic-job-requirement config #:key (home-service? #f)) + (define maybe-requirement (restic-backup-job-requirement config)) + (if (maybe-value-set? maybe-requirement) + maybe-requirement + (if home-service? + '() + '(user-processes file-systems)))) + +(define* (restic-backup-job-modules #:key (home-service? #f)) + `((shepherd service timer) + ,@(if home-service? + ;;for %user-log-dir + '((shepherd support)) + '()))) + +(define* (restic-backup-job->shepherd-service config #:key (home-service? #f)) (let ((schedule (restic-backup-job-schedule config)) (name (restic-backup-job-name config)) + (files (restic-backup-job-files config)) (user (restic-backup-job-user config)) (group (restic-backup-job-group config)) (max-duration (restic-backup-job-max-duration config)) (wait-for-termination? (restic-backup-job-wait-for-termination? config)) - (log-file (restic-job-log-file config)) - (requirement (restic-backup-job-requirement config))) + (log-file (restic-job-log-file + config #:home-service? home-service?)) + (requirement + (restic-job-requirement config #:home-service? home-service?))) (shepherd-service (provision `(,(string->symbol name))) - (requirement - `(user-processes file-systems ,@requirement)) + (requirement requirement) (documentation - "Run @code{restic} backed backups on a regular basis.") - (modules '((shepherd service timer))) + "Run restic backed backups on a regular basis.") + (modules (restic-backup-job-modules + #:home-service? home-service?)) (start #~(make-timer-constructor (if (string? #$schedule) (cron-string->calendar-event #$schedule) #$schedule) (command - (list - ;; We go through bash, instead of executing - ;; restic-guix directly, because the login shell - ;; gives us the correct user environment that some - ;; backends require, such as rclone. - (string-append #+bash-minimal "/bin/bash") - "-l" "-c" - (string-append "restic-guix backup " #$name)) - #:user #$user - #:group #$group - #:environment-variables - (list - (string-append - "HOME=" (passwd:dir (getpwnam #$user))))) + #$(restic-backup-job-command + name files #:home-service? home-service?) + #$@(if home-service? '() (list #:user user)) + #$@(if home-service? '() (list #:group group)) + #$@(if home-service? '() + (list + #:environment-variables + #~(list + (string-append + "HOME=" (passwd:dir (getpwnam #$user))))))) #:log-file #$log-file #:wait-for-termination? #$wait-for-termination? #:max-duration #$(and (maybe-value-set? max-duration) max-duration))) (stop #~(make-timer-destructor)) - (actions (list shepherd-trigger-action))))) + (actions (list (shepherd-action + (inherit shepherd-trigger-action) + (documentation "Manually trigger a backup, +without waiting for the scheduled time."))))))) (define (restic-guix-wrapper-package jobs) (package @@ -283,26 +353,19 @@ (define restic-backup-service-profile (restic-guix-wrapper-package jobs)) '()))) -(define (restic-backup-activation config) - #~(for-each - (lambda (log-file) - (mkdir-p (dirname log-file))) - (list #$@(map restic-job-log-file - (restic-backup-configuration-jobs config))))) - (define restic-backup-service-type (service-type (name 'restic-backup) (extensions (list - (service-extension activation-service-type - restic-backup-activation) (service-extension profile-service-type restic-backup-service-profile) (service-extension shepherd-root-service-type - (lambda (config) - (map restic-backup-job->shepherd-service - (restic-backup-configuration-jobs - config)))))) + (match-record-lambda + (jobs home-service?) + (map (lambda (job) + (restic-backup-job->shepherd-service + job #:home-service? home-service?)) + jobs))))) (compose concatenate) (extend (lambda (config jobs)