mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
services: home-niri: Validate configuration file.
* modules/rosenthal/services/desktop.scm (home-niri-configuration) [niri]: New field. (home-niri-service-type): Extend home-profile-service-type with it. (validated-niri-config): New procedure. (%home-niri-xdg-config): Use it.
This commit is contained in:
1 file changed
+17
-3
@@ -354,22 +354,36 @@
|
||||
;;;
|
||||
|
||||
(define-configuration/no-serialization home-niri-configuration
|
||||
(niri
|
||||
(file-like niri)
|
||||
"")
|
||||
(config
|
||||
maybe-file-like
|
||||
""))
|
||||
|
||||
(define (validated-niri-config niri file)
|
||||
(computed-file "niri.kdl"
|
||||
(with-imported-modules '((guix build utils))
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(invoke #+(file-append niri "/bin/niri") "validate"
|
||||
"--config" #$file)
|
||||
(copy-file #$file #$output)))))
|
||||
|
||||
(define %home-niri-xdg-config
|
||||
(match-record-lambda <home-niri-configuration>
|
||||
(config)
|
||||
(niri config)
|
||||
(if (maybe-value-set? config)
|
||||
`(("niri/config.kdl" ,config))
|
||||
`(("niri/config.kdl" ,(validated-niri-config niri config)))
|
||||
'())))
|
||||
|
||||
(define home-niri-service-type
|
||||
(service-type
|
||||
(name 'home-niri)
|
||||
(extensions
|
||||
(list (service-extension home-xdg-configuration-files-service-type
|
||||
(list (service-extension home-profile-service-type
|
||||
(compose list home-niri-configuration-niri))
|
||||
(service-extension home-xdg-configuration-files-service-type
|
||||
%home-niri-xdg-config)))
|
||||
(default-value (home-niri-configuration))
|
||||
(description
|
||||
|
||||
Reference in new issue
Block a user