2023-03-17 00:35:06 +01:00
|
|
|
(define-module (oni home services stumpwm)
|
2023-07-28 08:01:42 +02:00
|
|
|
#:use-module ((srfi srfi-1) #:select (every))
|
2023-03-17 00:35:06 +01:00
|
|
|
#:use-module ((gnu services configuration)
|
|
|
|
#:select (serialize-package
|
2023-07-28 08:01:42 +02:00
|
|
|
define-configuration
|
|
|
|
define-configuration/no-serialization
|
|
|
|
text-config?
|
|
|
|
serialize-text-config))
|
2023-06-21 07:51:40 +02:00
|
|
|
#:use-module ((gnu packages lisp)
|
|
|
|
#:select (sbcl))
|
2023-03-17 00:35:06 +01:00
|
|
|
#:use-module ((gnu packages wm)
|
2023-03-17 08:33:19 +01:00
|
|
|
#:select (stumpwm
|
2023-06-21 07:51:40 +02:00
|
|
|
stumpish
|
|
|
|
sbcl-stumpwm-swm-gaps))
|
2023-03-17 00:35:06 +01:00
|
|
|
#:use-module ((gnu home services)
|
|
|
|
#:select (service-type
|
|
|
|
service-extension
|
|
|
|
home-profile-service-type
|
2023-03-17 08:33:19 +01:00
|
|
|
home-xdg-configuration-files-service-type
|
|
|
|
home-run-on-change-service-type))
|
2023-03-17 00:35:06 +01:00
|
|
|
#:use-module ((guix gexp)
|
2023-03-17 08:33:19 +01:00
|
|
|
#:select (local-file
|
|
|
|
gexp
|
2023-07-28 08:01:42 +02:00
|
|
|
file-append
|
|
|
|
mixed-text-file))
|
2023-03-17 00:35:06 +01:00
|
|
|
#:use-module ((guix packages)
|
|
|
|
#:select (package?))
|
|
|
|
|
|
|
|
#:export (home-stumpwm-service-type
|
2023-07-28 08:01:42 +02:00
|
|
|
home-stumpwm-configuration
|
|
|
|
home-stumpwm-extension
|
|
|
|
|
|
|
|
home-stumpwm-gaps-service-type
|
|
|
|
home-stumpwm-gaps-configuration))
|
|
|
|
|
|
|
|
(define-configuration/no-serialization home-stumpwm-extension
|
|
|
|
(configurations
|
|
|
|
(text-config '())
|
|
|
|
"The configuration for the extension."))
|
2023-03-17 00:35:06 +01:00
|
|
|
|
|
|
|
(define-configuration home-stumpwm-configuration
|
|
|
|
(package
|
|
|
|
(package stumpwm)
|
2023-03-17 08:33:19 +01:00
|
|
|
"Package to use for setting Stumpwm")
|
2023-07-28 08:01:42 +02:00
|
|
|
(configurations
|
|
|
|
(text-config '())
|
|
|
|
"The configuration to apply.")
|
2023-03-17 08:33:19 +01:00
|
|
|
(stumpish-package
|
|
|
|
(package stumpish)
|
|
|
|
"Package to use for setting Stumpish"))
|
2023-03-17 00:35:06 +01:00
|
|
|
|
|
|
|
(define (add-stumpwm-packages config)
|
2023-07-28 08:01:42 +02:00
|
|
|
(append (list sbcl
|
|
|
|
(home-stumpwm-configuration-package config)
|
|
|
|
(list stumpwm "lib")
|
|
|
|
(home-stumpwm-configuration-stumpish-package config))))
|
|
|
|
|
|
|
|
(define (home-stumpwm-extensions original-config extension-configs)
|
|
|
|
(home-stumpwm-configuration
|
|
|
|
(inherit original-config)
|
|
|
|
(configurations
|
|
|
|
(apply append (home-stumpwm-configuration-configurations original-config)
|
|
|
|
(map home-stumpwm-extension-configurations extension-configs)))))
|
2023-03-17 00:35:06 +01:00
|
|
|
|
|
|
|
(define (home-stumpwm-config-files config)
|
2023-07-28 08:01:42 +02:00
|
|
|
`(("stumpwm/config"
|
|
|
|
,(mixed-text-file
|
|
|
|
"config"
|
|
|
|
(serialize-text-config config (home-stumpwm-configuration-configurations config))))))
|
2023-03-17 00:35:06 +01:00
|
|
|
|
2023-03-17 08:33:19 +01:00
|
|
|
(define (reload-stumpwm-config-gexp _)
|
|
|
|
`(("files/.config/stumpwm/config"
|
|
|
|
,#~(system* #$(file-append stumpish "/bin/stumpish") "reload"))))
|
|
|
|
|
2023-03-17 00:35:06 +01:00
|
|
|
(define home-stumpwm-service-type
|
|
|
|
(service-type
|
|
|
|
(name 'home-stumpwm)
|
|
|
|
(extensions
|
|
|
|
(list (service-extension
|
|
|
|
home-profile-service-type
|
|
|
|
add-stumpwm-packages)
|
|
|
|
(service-extension
|
|
|
|
home-xdg-configuration-files-service-type
|
2023-03-17 08:33:19 +01:00
|
|
|
home-stumpwm-config-files)
|
|
|
|
(service-extension
|
|
|
|
home-run-on-change-service-type
|
|
|
|
reload-stumpwm-config-gexp)))
|
2023-03-17 00:35:06 +01:00
|
|
|
(compose identity)
|
2023-07-28 08:01:42 +02:00
|
|
|
(extend home-stumpwm-extensions)
|
2023-03-17 00:35:06 +01:00
|
|
|
(default-value (home-stumpwm-configuration))
|
|
|
|
(description "Install and configure stumpwm.")))
|
2023-07-28 08:01:42 +02:00
|
|
|
|
|
|
|
(define-configuration/no-serialization home-stumpwm-gaps-configuration
|
|
|
|
(package
|
|
|
|
(package sbcl-stumpwm-swm-gaps)
|
|
|
|
"Package to use for setting stumpwm-gaps.")
|
|
|
|
(configurations
|
|
|
|
(text-config '())
|
|
|
|
"Configuration for stumpwm gaps"))
|
|
|
|
|
|
|
|
(define (add-stumpwm-gaps config)
|
|
|
|
(home-stumpwm-extension
|
|
|
|
(configurations (home-stumpwm-gaps-configuration-configurations config))))
|
|
|
|
|
|
|
|
(define (add-stumpwm-gaps-packages config)
|
|
|
|
(list (home-stumpwm-gaps-configuration-package config)))
|
|
|
|
|
|
|
|
(define home-stumpwm-gaps-service-type
|
|
|
|
(service-type
|
|
|
|
(name 'home-stumpwm-gaps)
|
|
|
|
(extensions
|
|
|
|
(list (service-extension
|
|
|
|
home-stumpwm-service-type
|
|
|
|
add-stumpwm-gaps)
|
|
|
|
(service-extension
|
|
|
|
home-profile-service-type
|
|
|
|
add-stumpwm-gaps-packages)))
|
|
|
|
(compose identity)
|
|
|
|
(default-value (home-stumpwm-gaps-configuration))
|
|
|
|
(description "Install and configure stumpwm-gaps.")))
|