aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services/stumpwm.scm
blob: ebda987086ec98aaa7ec600dcb810dc20eb24d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(define-module (oni home services stumpwm)
  #:use-module ((gnu services configuration)
                #:select (serialize-package
                          define-configuration))
  #:use-module ((gnu packages wm)
                #:select (stumpwm
                          stumpish))
  #:use-module ((gnu home services)
                #:select (service-type
                          service-extension
                          home-profile-service-type
                          home-xdg-configuration-files-service-type
                          home-run-on-change-service-type))
  #:use-module ((guix gexp)
                #:select (local-file
                          gexp
                          file-append))
  #:use-module ((guix packages)
                #:select (package?))

  #:export (home-stumpwm-service-type
            home-stumpwm-configuration))

(define-configuration home-stumpwm-configuration
  (package
    (package stumpwm)
    "Package to use for setting Stumpwm")
  (stumpish-package
   (package stumpish)
   "Package to use for setting Stumpish"))

(define (add-stumpwm-packages config)
  (list (home-stumpwm-configuration-package config)
        (home-stumpwm-configuration-stumpish-package config)))

(define (home-stumpwm-config-files config)
  `(("stumpwm/config" ,(local-file "stumpwm/config"))))

(define (reload-stumpwm-config-gexp _)
  `(("files/.config/stumpwm/config"
     ,#~(system* #$(file-append stumpish "/bin/stumpish") "reload"))))

(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
           home-stumpwm-config-files)
          (service-extension
           home-run-on-change-service-type
           reload-stumpwm-config-gexp)))
   (compose identity)
   (default-value (home-stumpwm-configuration))
   (description "Install and configure stumpwm.")))