system: 'operating-system-with-provenance' uses the OS location info.

This allows 'guix deploy' to save the config file when it's available.

* gnu/system.scm (operating-system-configuration-file): New procedure.
(operating-system-with-provenance): 'config-file' defaults to the value
returned by 'operating-system-configuration-file'.
This commit is contained in:
Ludovic Courtès 2020-07-28 22:36:20 +02:00
parent 5c622a0a68
commit 12a3d7d6f7
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 14 additions and 1 deletions

View File

@ -651,7 +651,20 @@ bookkeeping."
gc-root-service-type roots)
(operating-system-user-services os)))))
(define* (operating-system-with-provenance os #:optional config-file)
(define (operating-system-configuration-file os)
"Return the configuration file of OS, based on its 'location' field, or #f
if it could not be determined."
(let ((file (and=> (operating-system-location os)
location-file)))
(and file
(or (and (string-prefix? "/" file) file)
(search-path %load-path file)))))
(define* (operating-system-with-provenance os
#:optional
(config-file
(operating-system-configuration-file
os)))
"Return a variant of OS that stores its own provenance information,
including CONFIG-FILE, if available. This is achieved by adding an instance
of PROVENANCE-SERVICE-TYPE to its services."