From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cMZWEwkPs2NrAwEAbAwnHQ (envelope-from ) for ; Mon, 02 Jan 2023 18:06:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2K39EgkPs2OdOwAAauVa8A (envelope-from ) for ; Mon, 02 Jan 2023 18:06:17 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C288416D2E for ; Mon, 2 Jan 2023 18:06:16 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCOGC-0007kJ-Ay; Mon, 02 Jan 2023 12:06:04 -0500 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 1pCOGA-0007k3-7c for guix-patches@gnu.org; Mon, 02 Jan 2023 12:06:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCOG9-0006va-Vc for guix-patches@gnu.org; Mon, 02 Jan 2023 12:06:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pCOG9-0000xy-RF for guix-patches@gnu.org; Mon, 02 Jan 2023 12:06:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60497] [PATCH] services: unattended-upgrade: Add 'expression' field. References: <868271b51416d65038128233f85f88f8@autistici.org> In-Reply-To: <868271b51416d65038128233f85f88f8@autistici.org> Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Jan 2023 17:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60497 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60497@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 60497-submit@debbugs.gnu.org id=B60497.16726791553701 (code B ref 60497); Mon, 02 Jan 2023 17:06:01 +0000 Received: (at 60497) by debbugs.gnu.org; 2 Jan 2023 17:05:55 +0000 Received: from localhost ([127.0.0.1]:43936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOG2-0000xd-IT for submit@debbugs.gnu.org; Mon, 02 Jan 2023 12:05:55 -0500 Received: from confino.investici.org ([93.190.126.19]:63101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOG0-0000xT-As for 60497@debbugs.gnu.org; Mon, 02 Jan 2023 12:05:53 -0500 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4Nm2Lk61B8z10ww; Mon, 2 Jan 2023 17:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1672679150; bh=84/970NjCnvo4J84r1z03QZGxXH5bD+F5ep+xCej4jo=; h=From:To:Cc:Subject:Date:From; b=WBAAmF5HYjZxTFUBIBllTjRklHZxIP3UEr4BdTC/DtdAKVnpgI9Wok7+/tWyjHhY1 tQAX5wQSY/8angBc3zcj8KmKQcNMjjQ9Uuzx+uL7t3YbKvsjIv109FwAXYvm2AZ687 eXnEPCcjXbdOlpt/rPm9MkIC3dJBQwCF/XwfzBMU= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4Nm2Lk54xrz10w6; Mon, 2 Jan 2023 17:05:50 +0000 (UTC) Date: Mon, 2 Jan 2023 18:05:24 +0100 Message-Id: <20230102170524.32115-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Giacomo Leidi via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672679176; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=84/970NjCnvo4J84r1z03QZGxXH5bD+F5ep+xCej4jo=; b=UFmaourUNehh0po/wUuP09S/xFR7jd6HfV31HTPO8qEuAy+A3N02PkoHi8chvDKNdu7n5I Nmbd/+4ApSis7EnG5/NLwRI/uXW5xetESNCSzKk5DoQnlVoFqWCGTmYzUZ6pSguAWYz70U HYLXI6wZDOJ732v6b/AKQN7pEwy6k/XaXC9OtwXqQ437HEEOseNWPanXy9U+XJFCEk1geM 7y3JKFgZAOdF/u2dRNLuA2okpWEuW5Bao+1zJf2DncVCeKAE8/VprLNsN7hk6DhAJNoV8f Knud9io2NJA+6zmnZv+ughW9+8/InS73XBnt+0rrhP0ZPCBtJ68VXYbP0K5QoA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=WBAAmF5H; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1672679176; a=rsa-sha256; cv=none; b=i3qdQPfrF2yBgiiQVewEZkWxzLHMFoIB54F7KplUpVblAR19e2lmCYMg/sBsx5dNjGunY5 oTDjO4Fz+KoLAwwQO0ZAUJscESqH97xEORrklo02pe5+A0ghzEDgbfuWKfIFp1PlrLxxS5 D8rlHf6gi2UrSVFZkTrd1ohF12HJb7+gMibtDpGVDnTZuz12N7H67Oa//QBhvLsF4kJJ9M Ngi7tQKokTNJ5WXTqrEETG7twNVKYMFPM7ANVPhkwVml/sjGKQQWwjcPjYq85TPyhvNukk fiYvYDIZJrCzZ1NL1niQoh74DWA2CWmoz4fVe69+msL10rwU1NWtU5tC/vUbtQ== X-Spam-Score: -3.55 X-Migadu-Queue-Id: C288416D2E Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=WBAAmF5H; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -3.55 X-TUID: 9YR9VutsUQfa * gnu/services/admin.scm ()[expression]: New field. (unattended-upgrade-mcron-jobs): Honor it. * doc/guix.texi (Unattended Upgrades): Document it. --- doc/guix.texi | 12 ++++++++++++ gnu/services/admin.scm | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5c85680831..cf109cf3d6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@* Copyright @copyright{} 2022 Simon Streit@* Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* +Copyright @copyright{} 2023 Giacomo Leidi@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -21270,6 +21271,17 @@ This gexp specifies the channels to use for the upgrade (@pxref{Channels}). By default, the tip of the official @code{guix} channel is used. +@item @code{expression} (default: @code{#f}) +This field specifies the Guile expression to use for the upgrade +(@pxref{Invoking guix system}) as a list of symbols. If no value is provided the +@code{operating-system-file} field value will be used. + +@lisp +(unattended-upgrade-configuration + (expression + '(@@ (guix system install) installation-os))) +@end lisp + @item @code{operating-system-file} (default: @code{"/run/current-system/configuration.scm"}) This field specifies the operating system configuration file to use. The default is to reuse the config file of the current configuration. diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 252bedb0bd..ff5ceae47e 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016-2022 Ludovic Courtès ;;; Copyright © 2020 Brice Waegeneire +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +31,7 @@ (define-module (gnu services admin) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) + #:use-module (ice-9 format) #:use-module (ice-9 vlist) #:export (%default-rotations %rotated-files @@ -57,6 +59,7 @@ (define-module (gnu services admin) unattended-upgrade-service-type unattended-upgrade-configuration unattended-upgrade-configuration? + unattended-upgrade-configuration-expression unattended-upgrade-configuration-operating-system-file unattended-upgrade-configuration-channels unattended-upgrade-configuration-schedule @@ -263,6 +266,8 @@ (define-record-type* unattended-upgrade-configuration? (operating-system-file unattended-upgrade-operating-system-file (default "/run/current-system/configuration.scm")) + (expression unattended-upgrade-expression + (default #f)) (schedule unattended-upgrade-configuration-schedule (default "30 01 * * 0")) (channels unattended-upgrade-configuration-channels @@ -296,6 +301,14 @@ (define expiration (define config-file (unattended-upgrade-operating-system-file config)) + (define expression + (unattended-upgrade-expression config)) + + (define reconfigure-args + (if expression + #~(list "-e" (format #t "~s" expression)) + #~(list config-file))) + (define code (with-imported-modules (source-module-closure '((guix build utils) (gnu services herd))) @@ -335,7 +348,7 @@ (define (alarm-handler . _) (report-invoke-error c))) (invoke #$(file-append guix "/bin/guix") "time-machine" "-C" #$channels - "--" "system" "reconfigure" #$config-file) + "--" "system" "reconfigure" #$@reconfigure-args) ;; 'guix system delete-generations' fails when there's no ;; matching generation. Thus, catch 'invoke-error?'. base-commit: 7efcf36e3b753a1dba6f8208f3c22d151007eaf0 -- 2.38.1