Subject: [bug#70542] [PATCH 1/4] file-systems: Add requirements field to file-systems

From: Liliana Marie Prikler <[email-masked]>
Date: Wed, 24 Apr 2024 19:31:50 +0200

Am Dienstag, dem 23.04.2024 um 16:47 -0400 schrieb Richard Sent:
> * gnu/system/file-systems.scm (file-system): Add requirements field
> to the
> file-system record. This field will be used for adding additional
> Shepherd
> requirements to a file system Shepherd service.
> * doc/guix.texi: Add documentation for file-system requirements.
> 
> Change-Id: If0392db03d48e8820aa53df1df482c12ec72e1a5
> ---
>  doc/guix.texi               | 13 +++++++++++++
>  gnu/system/file-systems.scm |  3 +++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 65af136e61..80b24e2de9 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -17751,6 +17751,19 @@ File Systems
>  
>  Another example is a file system that depends on a mapped device,
> for
>  example for an encrypted partition (@pxref{Mapped Devices}).
> +
> +@item @code{requirements} (default: @code{'()})
> +This is a list of symbols denoting Shepherd requirements that must
> be
> +met before mounting the file system.
> +
> +As an example, an NFS file system would typically have a requirement
> for
> +@code{networking}.
> +
> +Typically, file systems are mounted before most other Shepherd
> services
> +are started. However, file systems with a non-empty requirements
> field
> +are mounted after Shepherd services have begun. Any Shepherd service
> +that depends on a file system with a non-empty requirements field
> must
> +depend on it directly and not on the generic symbol @code{file-
> systems}.
>  @end table
>  @end deftp
>  
> diff --git a/gnu/system/file-systems.scm b/gnu/system/file-
> systems.scm
> index af0567bd3e..76a51a2b69 100644
> --- a/gnu/system/file-systems.scm
> +++ b/gnu/system/file-systems.scm
> @@ -57,6 +57,7 @@ (define-module (gnu system file-systems)
>              file-system-repair
>              file-system-create-mount-point?
>              file-system-dependencies
> +            file-system-requirements
>              file-system-location
>  
>              file-system-type-predicate
> @@ -185,6 +186,8 @@ (define-record-type* <file-system> file-system
>                         (default #f))
>    (dependencies     file-system-dependencies      ; list of <file-
> system>
>                      (default '()))                ; or <mapped-
> device>
> +  (requirements     file-system-requirements      ; list of symbols
> +                    (default '()))
>    (location         file-system-location
>                      (default (current-source-location))
>                      (innate)))
LGTM, could possibly be merged with 2/4 if others agree.

Cheers