home: xdg: Add with-imported-modules to xdg activation script.

Without it activation doesn't work when called in clean environment.

* gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation): Add
with-imported-modules to xdg activation script.
This commit is contained in:
Andrew Tropin 2022-12-22 10:22:00 +04:00
parent 1b29fccff2
commit dd4eee5581
No known key found for this signature in database
GPG Key ID: 2208D20958C1DEB0

View File

@ -120,22 +120,25 @@ services more consistent."))
home-xdg-base-directories-configuration-fields))
(define (ensure-xdg-base-dirs-on-activation config)
#~(map (lambda (xdg-base-dir-variable)
((@ (guix build utils) mkdir-p)
(getenv
xdg-base-dir-variable)))
'#$(filter-map
(lambda (field)
(let ((variable
(string-append
"XDG_"
(object->snake-case-string
(configuration-field-name field) 'upper))))
;; XDG_RUNTIME_DIR shouldn't be created during activation
;; and will be provided by elogind or other service.
(and (not (string=? "XDG_RUNTIME_DIR" variable))
variable)))
home-xdg-base-directories-configuration-fields)))
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
(map (lambda (xdg-base-dir-variable)
(mkdir-p
(getenv
xdg-base-dir-variable)))
'#$(filter-map
(lambda (field)
(let ((variable
(string-append
"XDG_"
(object->snake-case-string
(configuration-field-name field) 'upper))))
;; XDG_RUNTIME_DIR shouldn't be created during activation
;; and will be provided by elogind or other service.
(and (not (string=? "XDG_RUNTIME_DIR" variable))
variable)))
home-xdg-base-directories-configuration-fields)))))
(define (last-extension-or-cfg config extensions)
"Picks configuration value from last provided extension. If there