projects/guix·blob python-team · refs

64 lines · 2.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021, 2023 Andrew Tropin <[email protected]>
3;;; Copyright © 2021 Xinglu Chen <[email protected]>
4;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
5;;; Copyright © 2023 Ludovic Courtès <[email protected]>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23;;
24;; Service for the GNU mcron cron job manager.
25;;
26;; Example configuration, the first job runs mbsync once every ten
27;; minutes, the second one writes "Mcron service" to ~/mcron-file once
28;; every minute.
29;;
30;; (service home-mcron-service-type
31;; (home-mcron-configuration
32;; (jobs (list #~(job '(next-minute
33;; (range 0 60 10))
34;; (lambda ()
35;; (system* "mbsync" "--all")))
36;; #~(job next-minute-from
37;; (lambda ()
38;; (call-with-output-file (string-append (getenv "HOME")
39;; "/mcron-file")
40;; (lambda (port)
41;; (display "Mcron service" port)))))))))
42;;
43;;; Code:
44
45(define-module (gnu home services mcron)
46 #:use-module (gnu home services)
47 #:use-module (gnu home services shepherd)
48 #:use-module (gnu services mcron) ;for the service mapping
49 #:export (home-mcron-configuration
50 home-mcron-service-type))
51
52(define-syntax-rule (home-mcron-configuration fields ...)
53 ;; Macro provided for backward compatibility.
54 (for-home (mcron-configuration fields ...)))
55
56(define home-mcron-service-type
57 (service-type
58 (inherit (system->home-service-type mcron-service-type))
59 (default-value (for-home (mcron-configuration)))))
60
61(define-service-type-mapping
62 mcron-service-type => home-mcron-service-type)
63
64;;; mcron.scm ends here