#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (guix profiles)
- #:use-module (guix ui)
- #:use-module (guix utils)
+ #:use-module ((guix utils) #:select (substitute-keyword-arguments))
+ #:use-module (guix i18n)
+ #:use-module (guix diagnostics)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages cross-base)
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."
"Variant of 'locale-name->definition' that raises an error upon failure."
(match (locale-name->definition name)
(#f
- (raise (condition
- (&message
- (message (format #f (G_ "~a: invalid locale name") name))))))
+ (raise (formatted-message (G_ "~a: invalid locale name") name)))
(def def)))
(define (operating-system-locale-directory os)