diff options
author | Giacomo Leidi <goodoldpaul@autistici.org> | 2023-01-02 18:05:24 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-01-10 11:49:14 +0100 |
commit | 5f63811032dab5c04c397e043cc7290cb3d51ee0 (patch) | |
tree | 0e2be1ba3e1cd7b73e83350a6211f65c9725b112 /gnu/services/admin.scm | |
parent | 22e9b01bdaa8184aa08f03542798750bc587b457 (diff) | |
download | guix-5f63811032dab5c04c397e043cc7290cb3d51ee0.tar guix-5f63811032dab5c04c397e043cc7290cb3d51ee0.tar.gz |
services: unattended-upgrade: Add 'operating-system-expression' field.
* gnu/services/admin.scm (<unattended-upgrade-configuration>)
[operating-system-expression]: New field.
(unattended-upgrade-mcron-jobs): Honor it.
* doc/guix.texi (Unattended Upgrades): Document it.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/admin.scm')
-rw-r--r-- | gnu/services/admin.scm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 252bedb0bd..1c10cfb1f6 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -1,7 +1,8 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> -;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> +;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -58,6 +59,7 @@ unattended-upgrade-configuration unattended-upgrade-configuration? unattended-upgrade-configuration-operating-system-file + unattended-upgrade-configuration-operating-system-expression unattended-upgrade-configuration-channels unattended-upgrade-configuration-schedule unattended-upgrade-configuration-services-to-restart @@ -263,6 +265,8 @@ Old log files are removed or compressed according to the configuration.") unattended-upgrade-configuration? (operating-system-file unattended-upgrade-operating-system-file (default "/run/current-system/configuration.scm")) + (operating-system-expression unattended-upgrade-operating-system-expression + (default #f)) (schedule unattended-upgrade-configuration-schedule (default "30 01 * * 0")) (channels unattended-upgrade-configuration-channels @@ -296,6 +300,14 @@ Old log files are removed or compressed according to the configuration.") (define config-file (unattended-upgrade-operating-system-file config)) + (define expression + (unattended-upgrade-operating-system-expression config)) + + (define arguments + (if expression + #~(list "-e" (object->string '#$expression)) + #~(list #$config-file))) + (define code (with-imported-modules (source-module-closure '((guix build utils) (gnu services herd))) @@ -333,9 +345,9 @@ Old log files are removed or compressed according to the configuration.") (format #t "~a starting upgrade...~%" (timestamp)) (guard (c ((invoke-error? c) (report-invoke-error c))) - (invoke #$(file-append guix "/bin/guix") - "time-machine" "-C" #$channels - "--" "system" "reconfigure" #$config-file) + (apply invoke #$(file-append guix "/bin/guix") + "time-machine" "-C" #$channels + "--" "system" "reconfigure" #$arguments) ;; 'guix system delete-generations' fails when there's no ;; matching generation. Thus, catch 'invoke-error?'. |