~whereiseveryone/guixrus

guixrus/guixrus/packages/clight.scm -rw-r--r-- 8.5 KiB
beb74e80(unmatched-parenthesis [urgent fix] turns out patch location doesn't work out of the box in non-`guix` channels... 8 days ago
                                                                                
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
;;; Clight package, dependencies and extending packages for GNU Guix.
;;; Copyright © 2021 florhizome <florhizome@posteo.net>
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;;
;;; This file is NOT part of GNU Guix.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages clight)
  #:use-module (guix utils)
  #:use-module (guix build utils)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (gnu packages)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system qt)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages base)
  #:use-module (gnu packages hardware)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages hardware)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages popt)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages image)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages polkit)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages bash))

;;; TODO: build: tests?
;;; Service's to actually use it

(define-public libmodule
  (package
   (name "libmodule")
   (version "5.0.1")
   (source
    (origin
      (method git-fetch)
     (uri (git-reference
           (url "https://github.com/FedeDP/libmodule")
           (commit version)))
     (sha256
      (base32 "1j48gkj6zlifrmx9qh37ijmqjvdvgmpvxah7j2qlrhdxcc6n4i62"))))
   (build-system cmake-build-system)
   (native-inputs `(("pkg-config" ,pkg-config)))
   (arguments '(#:tests? #f)) ; tests not found
   (home-page "https://github.com/FedeDP/libmodule")
   (synopsis "C simple implementation of an actor library")
   (description "Libmodule offers a small and simple C implementation
 of an actor library that aims to let developers easily create modular
 C projects in a way which is both simple and elegant.")
   (license license:gpl3)))

(define-public clight
  (package
   (name "clight")
   (version "4.7")
   (source
    (origin
      (method git-fetch)
     (uri (git-reference
           (url "https://github.com/FedeDP/clight")
           (commit version)))
     (sha256
      (base32 "0i44vr5qn022cd1jb2rd9hg50jy0yk82jnl1kznf1jfli9g79vps"))))
    (build-system cmake-build-system)
    (native-inputs (list pkg-config libmodule))
    (inputs `(("elogind" ,elogind)
              ("libconfig" ,libconfig)
              ("popt" ,popt)
              ("libmodule" ,libmodule)
              ("dbus",dbus)
              ("bash-completion" ,bash-completion)
              ("gsl" ,gsl)))
    (propagated-inputs `(("geoclue" ,geoclue)
                         ("upower" ,upower)
                         ("clightd" ,clightd)
                         ("ddcutil" ,ddcutil)
                         ("bash-completion" ,bash-completion)))
    (arguments
     `(#:tests? #f ; tests not found
       #:phases
       (modify-phases %standard-phases
                      (add-after
                       'patch-source-shebangs 'patch-target-dirs
                       (lambda* (#:key outputs #:allow-other-keys)
                         (let* ((out (assoc-ref outputs "out")))
                           (substitute*
                            "./CMakeLists.txt"
                            (("DESTINATION \\$\\{SESSION_BUS_DIR\\}")
                             (string-append
                              "DESTINATION " out
                              "/share/dbus-1/services")))
                           (substitute*
                            "./CMakeLists.txt"
                            (("DESTINATION /etc/xdg/autostart")
                             (string-append
                              "DESTINATION " out
                              "/etc/xdg/autostart")))
                           (substitute*
                            "./CMakeLists.txt"
                            (("DESTINATION /usr/share/*")
                             (string-append "DESTINATION " out
                                            "/share/*")))
                           (substitute*
                            "./CMakeLists.txt"
                            (("DESTINATION \\$\\{BASH_COMPLETIONS_DIR\\}")
                             (string-append "DESTINATION "
                                            out "/share/bash-completion")))))))))
    (home-page "https://github.com/FedeDP/Clight")
    (synopsis "C user daemon utility that aims to fully manage your screens")
    (description "This is a tiny C utility that can turn your webcam into a
light sensor; moreover it supports a redshift-like gamma control, a screen
dimmer and dpms settings.")
    (license license:gpl3)))

(define-public clightd
  (package
    (name "clightd")
    (version "5.4")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference  
          (url "https://github.com/FedeDP/Clightd")
          (commit version)))
       (sha256
        (base32 "04bl9jrh4msz792clhp0i4ascgghbx6w4gzprs7fdps1frzb35m6"))))
    (build-system cmake-build-system)
    (native-inputs (list pkg-config libmodule))
    (inputs 
      `(("libxrandr" ,libxrandr)
        ("wayland-protocols" ,wayland-protocols)
        ("libdrm" ,libdrm)
        ("libjpeg-turbo" ,libjpeg-turbo)
        ("wayland" ,wayland)
        ("libmodule" ,libmodule)
        ("libx11" ,libx11)
        ("libxext" ,libxext)
        ("polkit" ,polkit)
        ("eudev" ,eudev)
        ("elogind" ,elogind)
        ("dbus" ,dbus)
        ("libusb" ,libusb)))
        ;;needed only for yoctolight support, but why not
    (propagated-inputs
     `(("ddcutil" ,ddcutil)))
    (arguments
     `(#:tests? #f  ; tests not found
       #:configure-flags '("-DENABLE_GAMMA=1"
                           "-DENABLE_DPMS=1"
                           "-DENABLE_DDC=1"
                           "-DENABLE_SCREEN=1"
                           "-DENABLE_YOCTOLIGHT=1") ; well, why not ;)
       #:phases
       (modify-phases %standard-phases
         (add-after
             'patch-source-shebangs 'patch-target-dirs
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (substitute*
                   "./CMakeLists.txt"
                 (("DESTINATION \\$\\{SYSTEM_BUS_DIR\\}")
                  (string-append "DESTINATION "
                                 out "/share/dbus-1/system-services")))
               (substitute*
                   "./CMakeLists.txt"
                 (("DESTINATION \\$\\{POLKIT_ACTION_DIR\\}")
                  (string-append "DESTINATION "
                                 out "/share/polkit-1/actions")))
               (substitute*
                   "./CMakeLists.txt"
                 (("DESTINATION \\$\\{MODULE_LOAD_DIR\\}")
                  (string-append "DESTINATION "
                                 out "/etc/modprobe.d")))
               (substitute*
                   "./CMakeLists.txt"
                 (("DESTINATION \\$\\{DBUS_CONFIG_DIR\\}")
                  (string-append "DESTINATION "
                                 out "/share/dbus-1/system.d"))))))
         (add-after 'build 'symlink-clightd-in-PATH
           (lambda _
             (mkdir-p (string-append
                       (assoc-ref %outputs "out") "/bin"))
             (symlink
              (string-append (assoc-ref %outputs "out") "/libexec/clightd")
              (string-append (assoc-ref %outputs "out") "/bin/clightd")))))))
    (home-page "https://github.com/FedeDP/Clight")
    (synopsis "Daemon dbus interface to for backlight and display settings")
    (description 
"A linux bus interface that lets you change screen brightness, compute
captured webcam frames brightness and change screen temperature.")
    (license license:gpl3)))