guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#44900] [PATCH] services: unattended-upgrade: Add 'search-paths' fie


From: Ludovic Courtès
Subject: [bug#44900] [PATCH] services: unattended-upgrade: Add 'search-paths' field.
Date: Sat, 28 Nov 2020 11:33:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis:

> I’m using a modular machine configuration, i.e. the scheme file returning the
> operating system definition imports several other custom modules with service
> definitions etc in the same directory. This does not work well with unattended
> upgrades. The attached patch allows adding search paths to the unattended
> upgrade service. I’m not sure this is the best solution though. Maybe the
> preferred way to add these modules is to a custom channel?

Did you see (info "(guix) Unattended Upgrades"):

          There are cases, though, where referring to
          ‘/run/current-system/configuration.scm’ is not enough, for
          instance because that file refers to extra files (SSH public
          keys, extra configuration files, etc.)  via ‘local-file’ and
          similar constructs.  For those cases, we recommend something
          along these lines:

               (unattended-upgrade-configuration
                 (operating-system-file
                   (file-append (local-file "." "config-dir" #:recursive? #t)
                                "/config.scm")))

          The effect here is to import all of the current directory into
          the store, and to refer to ‘config.scm’ within that directory.
          Therefore, uses of ‘local-file’ within ‘config.scm’ will work
          as expected.  *Note G-Expressions::, for information about
          ‘local-file’ and ‘file-append’.

I can see several options:

  1. Use the trick above and add (say):

       (add-to-load-path (dirname (current-filename)))

     in your config file.  Not pretty.

  2. Turn your modules into a channel.  Nice because there’s no need for
     a special case, modules are automatically updated at each upgrade,
     etc., but OTOH requires more paperwork.

  3. What you propose.  Easy to use but a bit low-level and users could
     be tempted to pass local file names instead of using ‘local-file’,
     in which case the process becomes more brittle (depends on things
     outside the store).

> The second patch changes the default channels to #f, i.e. the system default
> (/etc/guix/channels.scm), which feels more natural to me.

I prefer being explicit here and keep ‘unattended-upgrade-configuration’
self-contained (/etc/guix/channels.scm could be modified behind our
back).

WDYT?

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]