Package: guix-patches;
Reported by: Herman Rimm <herman <at> rimm.ee>
Date: Fri, 20 Dec 2024 17:34:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74997 in the body.
You can then email your comments to 74997 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
andrew <at> trop.in, efraim <at> flashner.co.il, cox.katherine.e+guix <at> gmail.com, laurent.gatto <at> gmail.com, liliana.prikler <at> gmail.com, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 20 Dec 2024 17:34:01 GMT) Full text and rfc822 format available.Herman Rimm <herman <at> rimm.ee>
:andrew <at> trop.in, efraim <at> flashner.co.il, cox.katherine.e+guix <at> gmail.com, laurent.gatto <at> gmail.com, liliana.prikler <at> gmail.com, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org
.
(Fri, 20 Dec 2024 17:34:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: guix-patches <at> gnu.org Subject: [PATCH 1/5] import: utils: Rename guix-name to downstream-package-name. Date: Fri, 20 Dec 2024 18:32:32 +0100
* guix/import/cran.scm (cran-guix-name): Adjust. * guix/import/crate.scm (crate-name->package-name): Adjust. * guix/import/elpa.scm (elpa-guix-name): Adjust. * guix/import/npm-binary.scm (npm-name->name): Adjust. * guix/import/utils.scm (downstream-package-name): Add procedure. [description]: Use definite article, uppercase 'name' argument. (guix-name): Deprecate. Change-Id: I374892be18fbeaae1bc051b8d0c79ca4c33ed8c4 --- guix/import/cran.scm | 2 +- guix/import/crate.scm | 2 +- guix/import/elpa.scm | 2 +- guix/import/npm-binary.scm | 2 +- guix/import/utils.scm | 8 ++++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index fe69cb87f7..3bea9439e1 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -478,7 +478,7 @@ (define (transform-sysname sysname) ("zlib1g-dev" "zlib") (_ sysname))) -(define cran-guix-name (cut guix-name "r-" <>)) +(define cran-guix-name (cut downstream-package-name "r-" <>)) (define (directory-needs-fortran? dir) "Check if the directory DIR contains Fortran source files." diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 5996571cda..c50f0a8415 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -467,7 +467,7 @@ (define (guix-package->crate-name package) ((name _ ...) name)))) (define (crate-name->package-name name) - (guix-name "rust-" name)) + (downstream-package-name "rust-" name)) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index 46b6dc98a2..b86a6a546b 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -481,7 +481,7 @@ (define %elpa-updater (pred package-from-elpa-repository?) (import latest-release))) -(define elpa-guix-name (cut guix-name "emacs-" <>)) +(define elpa-guix-name (cut downstream-package-name "emacs-" <>)) (define* (elpa-recursive-import package-name #:optional (repo 'gnu)) (recursive-import package-name diff --git a/guix/import/npm-binary.scm b/guix/import/npm-binary.scm index 6dfedc4910..92ac7d338e 100644 --- a/guix/import/npm-binary.scm +++ b/guix/import/npm-binary.scm @@ -178,7 +178,7 @@ (define (npm-name->name npm-name) (define (clean name) (string-map (lambda (chr) (if (char=? chr #\/) #\- chr)) (string-filter (negate (cut char=? <> #\@)) name))) - (guix-name "node-" (clean npm-name))) + (downstream-package-name "node-" (clean npm-name))) (define (name+version->symbol name version) (string->symbol (string-append name "-" version))) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index e45c8dfb20..0b1b3b3298 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -37,6 +37,7 @@ (define-module (guix import utils) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix utils) #:use-module (guix packages) + #:use-module (guix deprecation) #:use-module (guix discovery) #:use-module (guix build-system) #:use-module ((guix i18n) #:select (G_)) @@ -82,6 +83,7 @@ (define-module (guix import utils) read-lines chunk-lines + downstream-package-name guix-name recursive-import)) @@ -612,14 +614,16 @@ (define* (chunk-lines lines #:optional (pred string-null?)) (reverse res) (loop (cdr after) res)))))) -(define (guix-name prefix name) - "Return a Guix package name for a given package name." +(define (downstream-package-name prefix name) + "Return the Guix package name for a given package NAME." (string-append prefix (string-map (match-lambda (#\_ #\-) (#\. #\-) (chr (char-downcase chr))) name))) +(define-deprecated/alias guix-name downstream-package-name) + (define (topological-sort nodes node-dependencies node-name) base-commit: 7f91b12fe31baa0838ae2e942d4515911e71b137 -- 2.45.2
andreas <at> enge.fr, guix <at> nicolasgoaziou.fr, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 20 Dec 2024 17:36:02 GMT) Full text and rfc822 format available.Message #8 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: 74997 <at> debbugs.gnu.org Subject: [PATCH 2/5] import: texlive: Remove guix-name. Date: Fri, 20 Dec 2024 18:35:02 +0100
* guix/import/texlive.scm (guix-name): Remove. (list-upstream-inputs, tlpdb->package): Use downstream-package-name. Change-Id: I8f04d27a42f762c5604cb8874042fabbbe1e9873 --- guix/import/texlive.scm | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm index 6d04cc25ee..8ce22a1d59 100644 --- a/guix/import/texlive.scm +++ b/guix/import/texlive.scm @@ -334,15 +334,6 @@ (define string->license ((lst ...) `(list ,@(map string->license lst))) (x `(error unknown-license ,x)))) -(define (guix-name name) - "Return a Guix package name for a given Texlive package NAME." - (string-append "texlive-" - (string-map (match-lambda - (#\_ #\-) - (#\. #\-) - (chr (char-downcase chr))) - name))) - (define* (filter-depends depends #:optional texlive-only) "Filter upstream package names DEPENDS to include only their equivalent Guix package names, without \"texlive-\" prefix. When TEXLIVE-ONLY is true, ignore @@ -578,7 +569,8 @@ (define (list-upstream-inputs upstream-name version database) (map (lambda (input-name) (upstream-input (name input-name) - (downstream-name (guix-name input-name)) + (downstream-name (downstream-package-name "texlive-" + input-name)) (type 'propagated))) (sort (append (filter-depends (or (assoc-ref package-data 'depend) '())) @@ -655,7 +647,7 @@ (define (texlive->svn-multi-reference upstream-name version database) (define (tlpdb->package upstream-name version database) (and-let* ((data (assoc-ref database upstream-name)) - (name (guix-name upstream-name)) + (name (downstream-package-name "texlive-" upstream-name)) (reference (texlive->svn-multi-reference upstream-name version database)) (source (with-store store -- 2.45.2
andreas <at> enge.fr, andrew <at> trop.in, guix <at> cbaines.net, dev <at> jpoiret.xyz, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, ludo <at> gnu.org, othacehe <at> gnu.org, guix <at> nicolasgoaziou.fr, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 20 Dec 2024 17:36:02 GMT) Full text and rfc822 format available.Message #11 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: 74997 <at> debbugs.gnu.org Subject: [PATCH 3/5] import: utils: Move downstream-package-name to (guix utils). Date: Fri, 20 Dec 2024 18:35:03 +0100
* guix/import/elpa.scm: Import (guix utils). * guix/import/texlive.scm: Import (guix utils). * guix/import/utils.scm (downstream-package-name): Move to ... * guix/utils.scm (downstream-package-name): ... here. Change-Id: If56a452f64ed06c8bb06a96a283a5067cb54d602 --- guix/import/elpa.scm | 1 + guix/import/texlive.scm | 1 + guix/import/utils.scm | 9 --------- guix/utils.scm | 9 +++++++++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index b86a6a546b..62b1d645ac 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -44,6 +44,7 @@ (define-module (guix import elpa) #:use-module (guix git) #:use-module (guix hash) #:use-module (guix store) + #:use-module ((guix utils) #:select (downstream-package-name)) #:use-module (guix base32) #:use-module (guix upstream) #:use-module (guix packages) diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm index 8ce22a1d59..8e67d11c69 100644 --- a/guix/import/texlive.scm +++ b/guix/import/texlive.scm @@ -35,6 +35,7 @@ (define-module (guix import texlive) #:use-module (guix store) #:use-module (guix svn-download) #:use-module (guix upstream) + #:use-module ((guix utils) #:select (downstream-package-name)) #:use-module (ice-9 ftw) #:use-module (ice-9 match) #:use-module (ice-9 popen) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 0b1b3b3298..6f5efa790e 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -83,7 +83,6 @@ (define-module (guix import utils) read-lines chunk-lines - downstream-package-name guix-name recursive-import)) @@ -614,14 +613,6 @@ (define* (chunk-lines lines #:optional (pred string-null?)) (reverse res) (loop (cdr after) res)))))) -(define (downstream-package-name prefix name) - "Return the Guix package name for a given package NAME." - (string-append prefix (string-map (match-lambda - (#\_ #\-) - (#\. #\-) - (chr (char-downcase chr))) - name))) - (define-deprecated/alias guix-name downstream-package-name) (define (topological-sort nodes diff --git a/guix/utils.scm b/guix/utils.scm index 537d0490e0..2d82329cb7 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -91,6 +91,7 @@ (define-module (guix utils) %current-system %current-target-system package-name->name+version + downstream-package-name target-linux? target-hurd? system-hurd? @@ -706,6 +707,14 @@ (define* (package-name->name+version spec (idx (values (substring spec 0 idx) (substring spec (1+ idx)))))) +(define (downstream-package-name prefix name) + "Return the Guix package name for a given package NAME." + (string-append prefix (string-map (match-lambda + (#\_ #\-) + (#\. #\-) + (chr (char-downcase chr))) + name))) + (define* (target-linux? #:optional (target (or (%current-target-system) (%current-system)))) "Does the operating system of TARGET use the Linux kernel?" -- 2.45.2
efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 20 Dec 2024 17:36:03 GMT) Full text and rfc822 format available.Message #14 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: 74997 <at> debbugs.gnu.org Subject: [PATCH 4/5] gnu: make-arm-trusted-firmware: Use downstream-package-name. Date: Fri, 20 Dec 2024 18:35:04 +0100
* gnu/packages/firmware.scm (make-arm-trusted-firmware): Use downstream-package-name. [arguments]: Remove configure phase, use fix-cross-build phase instead. (arm-trusted-firmware-sun50i-a64): Return base package directly. Change-Id: I23f05ac5e8e897037cd8d8afc4e747b05e56e32d --- gnu/packages/firmware.scm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 89d29b8add..04f138f22c 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -1108,7 +1108,7 @@ (define* (make-arm-trusted-firmware platform #:key ;;%current-system is a *triplet*, unlike its name would suggest. (string=? (%current-system) (gnu-triplet->nix-system triplet)))) (package - (name (string-append "arm-trusted-firmware-" platform)) + (name (downstream-package-name "arm-trusted-firmware-" platform)) (version "2.12") (source (origin @@ -1131,7 +1131,7 @@ (define* (make-arm-trusted-firmware platform #:key #:target (and (not (native-build?)) triplet) #:phases #~(modify-phases %standard-phases - (replace 'configure ;no configure script + (add-after 'unpack 'fix-cross-build ;; Fix ATF commit ffb7742125def3e0acca4c7e4d3215af5ce25a31 (lambda _ (unless #$(native-build?) @@ -1140,6 +1140,7 @@ (define* (make-arm-trusted-firmware platform #:key (substitute* "make_helpers/build_macros.mk" (("-oc") "-oc-default") (("-od") "-od-default"))))) + (delete 'configure) ;no configure script (replace 'install (lambda _ (for-each (lambda (file) @@ -1171,10 +1172,7 @@ (define* (make-arm-trusted-firmware platform #:key license:bsd-2)))) ; libfdt (define-public arm-trusted-firmware-sun50i-a64 - (let ((base (make-arm-trusted-firmware "sun50i_a64"))) - (package - (inherit base) - (name "arm-trusted-firmware-sun50i-a64")))) + (make-arm-trusted-firmware "sun50i_a64")) (define-public arm-trusted-firmware-rk3328 (make-arm-trusted-firmware "rk3328")) -- 2.45.2
efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 20 Dec 2024 17:36:03 GMT) Full text and rfc822 format available.Message #17 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: 74997 <at> debbugs.gnu.org Subject: [PATCH 5/5] gnu: u-boot: Use downstream-package-name. Date: Fri, 20 Dec 2024 18:35:05 +0100
* gnu/packages/bootloaders.scm (u-boot): Use downstream-package-name. Change-Id: I7226519a676ba201be3a95078112b6514a201731 --- gnu/packages/bootloaders.scm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 3122a185dd..b5cfacca4b 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -1041,9 +1041,7 @@ (define*-public (make-u-boot-package board triplet (gnu-triplet->nix-system triplet)))))) (package (inherit u-boot) - (name (string-append "u-boot-" - (string-replace-substring (string-downcase board) - "_" "-") + (name (string-append (downstream-package-name "u-boot-" board) (or name-suffix ""))) (description (if append-description (string-append (package-description u-boot) -- 2.45.2
Ludovic Courtès <ludo <at> gnu.org>
:Herman Rimm <herman <at> rimm.ee>
:Message #22 received at 74997-done <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Herman Rimm <herman <at> rimm.ee> Cc: Efraim Flashner <efraim <at> flashner.co.il>, Simon Tournier <zimon.toutoune <at> gmail.com>, Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>, Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Andrew Tropin <andrew <at> trop.in>, Ricardo Wurmus <rekado <at> elephly.net>, Laurent Gatto <laurent.gatto <at> gmail.com>, 74997-done <at> debbugs.gnu.org Subject: Re: [bug#74997] [PATCH 1/5] import: utils: Rename guix-name to downstream-package-name. Date: Mon, 30 Dec 2024 13:45:00 +0100
Applied, thanks!
herman <at> rimm.ee, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 17 Jan 2025 22:21:01 GMT) Full text and rfc822 format available.Message #25 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: 74997 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org> Subject: [PATCH 1/4] services: shepherd: Add ‘transient’ and ‘timer’. Date: Fri, 17 Jan 2025 23:19:20 +0100
* gnu/services/shepherd.scm (shepherd-timer-service-type) (shepherd-transient-service-type): New variables. * doc/guix.texi (Shepherd Services): Document them. Change-Id: I9b622e7e947e7a6384c2701a313d0c7080a0a5f6 --- doc/guix.texi | 33 ++++++++++++++++++++++++ gnu/services/shepherd.scm | 54 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0015d739bb..3e377ca9f4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -45684,6 +45684,39 @@ Shepherd Services (shepherd my-shepherd)))))) @end lisp +@cindex @code{transient} service, Shepherd +@defvar shepherd-transient-service-type +This service type represents the Shepherd's @code{transient} service, +which lets you spawn commands in the background and interact with them +as regular Shepherd service; it is similar to @command{systemd-run}. + +For example, the command below spawns @command{rsync} in the background, +in an environment where the @env{SSH_AUTH_SOCK} environment variable has +the given value: + +@example +herd spawn transient -E SSH_AUTH_SOCK=$SSH_AUTH_SOCK -- \ + rsync -e ssh -vur . backup.example.org: +@end example + +@xref{Transient Service Maker,,, shepherd, The GNU Shepherd Manual}, for +more info on the @code{transient} service. +@end defvar + +@cindex @code{timer} service, Shepherd +@defvar shepherd-timer-service-type +This is the service type representing the Shepherd's @code{timer} +service, which lets you schedule the execution of commands, similar to +the venerable @command{at} command. Here is an example: + +@example +herd schedule timer at 07:00 -- mpg123 Music/alarm.mp3 +@end example + +@xref{Timer Service,,, shepherd, The GNU Shepherd Manual}, for more info +on the @code{timer} service. +@end defvar + @defvar %shepherd-root-service This service represents PID <at> tie{}1. @end defvar diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 0de3c9c55c..5f2625ac20 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2016, 2018-2024 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2013-2016, 2018-2025 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org> ;;; Copyright © 2018 Carlo Zancanaro <carlo <at> zancanaro.id.au> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> @@ -81,6 +81,8 @@ (define-module (gnu services shepherd) shepherd-service-upgrade user-processes-service-type + shepherd-timer-service-type + shepherd-transient-service-type assert-valid-graph)) @@ -668,4 +670,52 @@ (define user-processes-service-type seconds after @code{SIGTERM} has been sent are terminated with @code{SIGKILL}."))) -;;; shepherd.scm ends here + +;;; +;;; Timer and transient service maker. +;;; + +(define shepherd-timer-service-type + (shepherd-service-type + 'shepherd-timer + (const (shepherd-service + (provision '(timer)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (free-form #~(timer-service + '#$provision + #:requirement '#$requirement)))) + #t ;ignored + (description "The Shepherd @code{timer} service lets you schedule commands +dynamically, similar to the @code{at} command that your grandparents would use +on that Slackware they got on a floppy disk. For example, consider this +command: + +@example +herd schedule timer at 07:00 -- mpg123 Music/alarm.mp3 +@end example + +It does exactly what you would expect."))) + +(define shepherd-transient-service-type + (shepherd-service-type + 'shepherd-transient + (const (shepherd-service + (provision '(transient)) + (requirement '(user-processes)) + (modules '((shepherd service transient))) + (free-form #~(transient-service + '#$provision + #:requirement '#$requirement)))) + #t ;ignored + (description "The Shepherd @code{transient} service lets you run commands +asynchronously, in the background, similar to @command{systemd-run}, as in +this example: + +@example +herd spawn transient -E SSH_AUTH_SOCK=$SSH_AUTH_SOCK -- \\ + rsync -e ssh -vur . backup.example.org: +@end example + +This runs @command{rsync} in the background, as a service that you can inspect +with @command{herd status} and stop with @command{herd stop}."))) -- 2.47.1
herman <at> rimm.ee, ludo <at> gnu.org, andrew <at> trop.in, janneke <at> gnu.org, tanguy <at> bioneland.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 17 Jan 2025 22:21:02 GMT) Full text and rfc822 format available.Message #28 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: 74997 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org> Subject: [PATCH 0/4] Adding the 'timer' and 'transient' Shepherd services Date: Fri, 17 Jan 2025 23:19:19 +0100
Hello! Shepherd party! 🐑🎉 This patch series adds the famous ‘transient’ and ‘timer’ services from Shepherd 1.0 that everyone has been waiting for. Thoughts? Ludo’. Ludovic Courtès (4): services: shepherd: Add ‘transient’ and ‘timer’. services: Add the Shepherd’s ‘transient’ and ‘timer’ to ‘%base-services’. home: services: shepherd: Add ‘transient’ and ‘timer’ services. home: services: Add ‘transient’ and ‘timer’ to ‘%base-home-services’. doc/guix.texi | 45 +++++++++++++++++++++++++++ gnu/home.scm | 7 +++-- gnu/home/services/shepherd.scm | 21 +++++++++++-- gnu/services/base.scm | 4 +++ gnu/services/shepherd.scm | 56 ++++++++++++++++++++++++++++++++-- 5 files changed, 127 insertions(+), 6 deletions(-) base-commit: a42d57a935009e4dd9b9e9464458540def2cb576 -- 2.47.1
herman <at> rimm.ee, ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 17 Jan 2025 22:21:02 GMT) Full text and rfc822 format available.Message #31 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: 74997 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org> Subject: [PATCH 2/4] services: Add the Shepherd’s ‘transient’ and ‘timer’ to ‘%base-services’. Date: Fri, 17 Jan 2025 23:19:21 +0100
* gnu/services/base.scm (%base-services): Add instances of ‘shepherd-timer-service-type’ and ‘shepherd-transient-service-type’. Change-Id: I28a35d0dce40b142ee71b330b1cf7a3d222ef6bd --- gnu/services/base.scm | 4 ++++ gnu/services/shepherd.scm | 34 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5967457002..7331c030d7 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -3750,6 +3750,10 @@ (define %base-services (service log-rotation-service-type) + ;; Convenient services brought by the Shepherd. + (service shepherd-timer-service-type) + (service shepherd-transient-service-type) + ;; Periodically delete old build logs. (service log-cleanup-service-type (log-cleanup-configuration diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 5f2625ac20..328bfbedff 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -678,14 +678,15 @@ (define user-processes-service-type (define shepherd-timer-service-type (shepherd-service-type 'shepherd-timer - (const (shepherd-service - (provision '(timer)) - (requirement '(user-processes)) - (modules '((shepherd service timer))) - (free-form #~(timer-service - '#$provision - #:requirement '#$requirement)))) - #t ;ignored + (lambda (requirement) + (shepherd-service + (provision '(timer)) + (requirement requirement) + (modules '((shepherd service timer))) + (free-form #~(timer-service + '#$provision + #:requirement '#$requirement)))) + '(user-processes) (description "The Shepherd @code{timer} service lets you schedule commands dynamically, similar to the @code{at} command that your grandparents would use on that Slackware they got on a floppy disk. For example, consider this @@ -700,14 +701,15 @@ (define shepherd-timer-service-type (define shepherd-transient-service-type (shepherd-service-type 'shepherd-transient - (const (shepherd-service - (provision '(transient)) - (requirement '(user-processes)) - (modules '((shepherd service transient))) - (free-form #~(transient-service - '#$provision - #:requirement '#$requirement)))) - #t ;ignored + (lambda (requirement) + (shepherd-service + (provision '(transient)) + (requirement requirement) + (modules '((shepherd service transient))) + (free-form #~(transient-service + '#$provision + #:requirement '#$requirement)))) + '(user-processes) (description "The Shepherd @code{transient} service lets you run commands asynchronously, in the background, similar to @command{systemd-run}, as in this example: -- 2.47.1
herman <at> rimm.ee, ludo <at> gnu.org, andrew <at> trop.in, janneke <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 17 Jan 2025 22:21:03 GMT) Full text and rfc822 format available.Message #34 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: 74997 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org> Subject: [PATCH 3/4] home: services: shepherd: Add ‘transient’ and ‘timer’ services. Date: Fri, 17 Jan 2025 23:19:22 +0100
* gnu/home/services/shepherd.scm (home-shepherd-timer-service-type) (home-shepherd-transient-service-type): New variables. * doc/guix.texi (Shepherd Home Service): Document them. (Shepherd Services): Add anchor. Change-Id: Ia4eb7cf043f4661c64f5ca81b8989a451532aa18 --- doc/guix.texi | 12 ++++++++++++ gnu/home/services/shepherd.scm | 21 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3e377ca9f4..a33f2f3083 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -45684,6 +45684,7 @@ Shepherd Services (shepherd my-shepherd)))))) @end lisp +@anchor{shepherd-transient-timer-services} @cindex @code{transient} service, Shepherd @defvar shepherd-transient-service-type This service type represents the Shepherd's @code{transient} service, @@ -47347,6 +47348,17 @@ Shepherd Home Service This service is part of @code{%base-home-services}. @end defvar +@defvar home-shepherd-transient-service-type +@defvarx home-shepherd-timer-service-type +These are the @code{timer} and @code{transient} Shepherd services. The +former lets you schedule command execution for later, while the latter +can run commands in the background as a regular service. + +@xref{shepherd-transient-timer-services, the system @code{timer} and +@code{transient} services}, which are their Guix System counterparts, +for more info. +@end defvar + @node Secure Shell @subsection Secure Shell diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index 37ad1489d6..b2b141d4de 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021, 2023 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> -;;; Copyright © 2024 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2024-2025 Ludovic Courtès <ludo <at> gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,7 +34,10 @@ (define-module (gnu home services shepherd) home-shepherd-configuration-auto-start? home-shepherd-configuration-daemonize? home-shepherd-configuration-silent? - home-shepherd-configuration-services) + home-shepherd-configuration-services + + home-shepherd-transient-service-type + home-shepherd-timer-service-type) #:re-export (shepherd-service shepherd-service? shepherd-service-documentation @@ -181,3 +184,17 @@ (define home-shepherd-service-type (define-service-type-mapping shepherd-root-service-type => home-shepherd-service-type) + +;;; +;;; Timer and transient service maker. +;;; + +(define home-shepherd-timer-service-type + (service-type + (inherit (system->home-service-type shepherd-timer-service-type)) + (default-value '()))) ;requirement + +(define home-shepherd-transient-service-type + (service-type + (inherit (system->home-service-type shepherd-transient-service-type)) + (default-value '()))) ;requirement -- 2.47.1
herman <at> rimm.ee, ludo <at> gnu.org, andrew <at> trop.in, janneke <at> gnu.org, tanguy <at> bioneland.org, guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Fri, 17 Jan 2025 22:21:03 GMT) Full text and rfc822 format available.Message #37 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: 74997 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org> Subject: [PATCH 4/4] home: services: Add ‘transient’ and ‘timer’ to ‘%base-home-services’. Date: Fri, 17 Jan 2025 23:19:23 +0100
* gnu/home.scm (%base-home-services): Add ‘home-shepherd-timer-service-type’ and ‘home-shepherd-transient-service-type’. Change-Id: Ib48744b82c7e4c6ff6b8ac3d669774feda813f4b --- gnu/home.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gnu/home.scm b/gnu/home.scm index 3b479f64f9..1172b1a0ab 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> -;;; Copyright © 2022, 2024 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2022, 2024-2025 Ludovic Courtès <ludo <at> gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +21,7 @@ (define-module (gnu home) #:use-module (gnu home services) #:use-module (gnu home services symlink-manager) #:use-module (gnu home services shells) + #:use-module (gnu home services shepherd) #:use-module (gnu home services xdg) #:use-module (gnu home services fontutils) #:use-module (gnu home services admin) @@ -80,7 +81,9 @@ (define-record-type* <home-environment> home-environment (define %base-home-services ;; Non-essential but useful services to have by default. - (list (service home-log-rotation-service-type))) + (list (service home-log-rotation-service-type) + (service home-shepherd-timer-service-type) + (service home-shepherd-transient-service-type))) (define (home-environment-default-essential-services he) "Return the list of essential services for home environment." -- 2.47.1
guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Sun, 19 Jan 2025 07:23:02 GMT) Full text and rfc822 format available.Message #40 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Ludovic Courtès <ludo <at> gnu.org> Cc: Herman Rimm <herman <at> rimm.ee>, 74997 <at> debbugs.gnu.org Subject: Re: [bug#74997] [PATCH 1/4] services: shepherd: Add ‘transient’ and ‘timer’. Date: Sun, 19 Jan 2025 16:21:47 +0900
Hi Ludovic, Ludovic Courtès <ludo <at> gnu.org> writes: > * gnu/services/shepherd.scm (shepherd-timer-service-type) > (shepherd-transient-service-type): New variables. > * doc/guix.texi (Shepherd Services): Document them. > > Change-Id: I9b622e7e947e7a6384c2701a313d0c7080a0a5f6 > --- > doc/guix.texi | 33 ++++++++++++++++++++++++ > gnu/services/shepherd.scm | 54 +++++++++++++++++++++++++++++++++++++-- > 2 files changed, 85 insertions(+), 2 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 0015d739bb..3e377ca9f4 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -45684,6 +45684,39 @@ Shepherd Services > (shepherd my-shepherd)))))) > @end lisp > > +@cindex @code{transient} service, Shepherd > +@defvar shepherd-transient-service-type > +This service type represents the Shepherd's @code{transient} service, > +which lets you spawn commands in the background and interact with them > +as regular Shepherd service; it is similar to @command{systemd-run}. > + > +For example, the command below spawns @command{rsync} in the background, > +in an environment where the @env{SSH_AUTH_SOCK} environment variable has > +the given value: > + > +@example > +herd spawn transient -E SSH_AUTH_SOCK=$SSH_AUTH_SOCK -- \ > + rsync -e ssh -vur . backup.example.org: > +@end example Neat! > +@xref{Transient Service Maker,,, shepherd, The GNU Shepherd Manual}, for > +more info on the @code{transient} service. > +@end defvar > + > +@cindex @code{timer} service, Shepherd > +@defvar shepherd-timer-service-type > +This is the service type representing the Shepherd's @code{timer} > +service, which lets you schedule the execution of commands, similar to > +the venerable @command{at} command. Here is an example: > + > +@example > +herd schedule timer at 07:00 -- mpg123 Music/alarm.mp3 > +@end example Also nice, though I'd use 'ogg123 Music/alarm.ogg' to promote more free formats! [...] > -;;; shepherd.scm ends here > + > +;;; > +;;; Timer and transient service maker. > +;;; > + > +(define shepherd-timer-service-type > + (shepherd-service-type > + 'shepherd-timer > + (const (shepherd-service > + (provision '(timer)) > + (requirement '(user-processes)) > + (modules '((shepherd service timer))) > + (free-form #~(timer-service > + '#$provision > + #:requirement '#$requirement)))) > + #t ;ignored > + (description "The Shepherd @code{timer} service lets you schedule commands > +dynamically, similar to the @code{at} command that your grandparents would use > +on that Slackware they got on a floppy disk. For example, consider this > +command: > + > +@example > +herd schedule timer at 07:00 -- mpg123 Music/alarm.mp3 > +@end example Ditto (I'd use Ogg Vorbis in the example). > +It does exactly what you would expect."))) > + > +(define shepherd-transient-service-type > + (shepherd-service-type > + 'shepherd-transient > + (const (shepherd-service > + (provision '(transient)) > + (requirement '(user-processes)) > + (modules '((shepherd service transient))) > + (free-form #~(transient-service > + '#$provision > + #:requirement '#$requirement)))) > + #t ;ignored > + (description "The Shepherd @code{transient} service lets you run commands > +asynchronously, in the background, similar to @command{systemd-run}, as in > +this example: > + > +@example > +herd spawn transient -E SSH_AUTH_SOCK=$SSH_AUTH_SOCK -- \\ > + rsync -e ssh -vur . backup.example.org: > +@end example > + > +This runs @command{rsync} in the background, as a service that you can inspect > +with @command{herd status} and stop with @command{herd stop}."))) Neat! Taking into account my previous nitpick: Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail> -- Thanks, Maxim
guix-patches <at> gnu.org
:bug#74997
; Package guix-patches
.
(Sun, 19 Jan 2025 07:25:01 GMT) Full text and rfc822 format available.Message #43 received at 74997 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Ludovic Courtès <ludo <at> gnu.org> Cc: Herman Rimm <herman <at> rimm.ee>, 74997 <at> debbugs.gnu.org Subject: Re: [bug#74997] [PATCH 2/4] services: Add the Shepherd’s ‘transient’ and ‘timer’ to ‘%base-services’. Date: Sun, 19 Jan 2025 16:24:30 +0900
Ludovic Courtès <ludo <at> gnu.org> writes: > * gnu/services/base.scm (%base-services): Add instances of > ‘shepherd-timer-service-type’ and ‘shepherd-transient-service-type’. The above changelog is incomplete (missing the refactor in gnu/services/shepherd.scm) Otherwise, Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail> -- Thanks, Maxim
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sun, 16 Feb 2025 12:24:16 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.