Subject: [bug#64471] [PATCH 1/2] services: Add 'file-database' service.

From: Bruno Victal <[email-masked]>
Date: Thu, 13 Jul 2023 19:00:46 +0100

Hi Ludo’,

On 2023-07-05 11:16, Ludovic Courtès wrote:
> +(define-record-type* <file-database-configuration>
> +  file-database-configuration make-file-database-configuration
> +  file-database-configuration?
> +  (package              file-database-configuration-package
> +                        (default
> +                          (let-system (system target)
> +                            ;; Unless we're cross-compiling, avoid pulling a
> +                            ;; second copy of findutils.
> +                            (if target
> +                                findutils
> +                                (canonical-package findutils)))))
> +  (schedule             file-database-configuration-schedule
> +                        (default %default-file-database-update-schedule))
> +  (excluded-directories file-database-configuration-excluded-directories
> +                        (default %default-file-database-excluded-directories)))

How about using define-configuration instead to have the documentation neatly
in sync with the fields?

> +
> +(define (file-database-mcron-jobs configuration)
> +  (match-record configuration <file-database-configuration>
> +    (package schedule excluded-directories)
> +    (let ((updatedb (program-file
> +                     "updatedb"
> +                     #~(execl #$(file-append package "/bin/updatedb")
> +                              "updatedb"
> +                              #$(string-append "--prunepaths="
> +                                               (string-join
> +                                                excluded-directories))))))
> +      (list #~(job #$schedule #$updatedb)))))

I'm afraid #$schedule might be insufficient if this is a _mcron_ time-spec.
There's an elaborate dance done by fstrim-service-type to handle the more exotic
mcron time expressions, perhaps you can reuse it here?

-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.