Commit | Line | Data |
---|---|---|
aadd1d24 | 1 | ;;; GNU Guix --- Functional package management for GNU |
21724ed9 | 2 | ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
01782ad0 | 3 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
22df0a1f | 4 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> |
aadd1d24 TGR |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (gnu packages hardware) | |
02ee43e4 | 22 | #:use-module (gnu packages admin) |
22a98cda | 23 | #:use-module (gnu packages autotools) |
02ee43e4 | 24 | #:use-module (gnu packages bash) |
aadd1d24 | 25 | #:use-module (gnu packages compression) |
02ee43e4 | 26 | #:use-module (gnu packages check) |
febd19da | 27 | #:use-module (gnu packages cpp) |
02ee43e4 BW |
28 | #:use-module (gnu packages crypto) |
29 | #:use-module (gnu packages documentation) | |
5eff4380 | 30 | #:use-module (gnu packages gcc) |
aadd1d24 TGR |
31 | #:use-module (gnu packages glib) |
32 | #:use-module (gnu packages libusb) | |
33 | #:use-module (gnu packages linux) | |
0ba0ab81 | 34 | #:use-module (gnu packages ncurses) |
02ee43e4 | 35 | #:use-module (gnu packages openldap) |
aadd1d24 | 36 | #:use-module (gnu packages pkg-config) |
02ee43e4 BW |
37 | #:use-module (gnu packages polkit) |
38 | #:use-module (gnu packages protobuf) | |
aadd1d24 | 39 | #:use-module (gnu packages xdisorg) |
22df0a1f | 40 | #:use-module (gnu packages xml) |
aadd1d24 TGR |
41 | #:use-module (gnu packages xorg) |
42 | #:use-module (guix build-system gnu) | |
43 | #:use-module (guix download) | |
0ba0ab81 | 44 | #:use-module (guix git-download) |
aadd1d24 TGR |
45 | #:use-module ((guix licenses) #:prefix license:) |
46 | #:use-module (guix packages)) | |
47 | ||
48 | ;; This is a module for packages related to physical hardware that don't (yet) | |
49 | ;; have a more specific home like gps.scm, security-token.scm, &c. | |
50 | ||
51 | (define-public ddcutil | |
52 | (package | |
53 | (name "ddcutil") | |
21724ed9 | 54 | (version "0.9.8") |
aadd1d24 TGR |
55 | (source |
56 | (origin | |
57 | (method url-fetch) | |
58 | (uri (string-append "https://www.ddcutil.com/tarballs/" | |
ec756fa5 | 59 | "ddcutil-" version ".tar.gz")) |
aadd1d24 | 60 | (sha256 |
21724ed9 | 61 | (base32 "13ccxbqgyz4ah9jwbcylnfkgl8j3ida8xd00xkcq4xnfyyv5mg6v")))) |
aadd1d24 TGR |
62 | (build-system gnu-build-system) |
63 | (native-inputs | |
64 | `(("pkg-config" ,pkg-config))) | |
65 | (inputs | |
66 | `(("eudev" ,eudev) | |
67 | ("glib" ,glib) | |
68 | ("libdrm" ,libdrm) ; enhanced diagnostics | |
69 | ("libusb" ,libusb) ; support USB monitors | |
70 | ("libx11" ,libx11) ; enhanced diagnostics | |
71 | ("libxrandr" ,libxrandr) | |
72 | ("zlib" ,zlib))) | |
73 | (home-page "https://www.ddcutil.com/") | |
74 | (synopsis "Control external monitor settings") | |
75 | (description | |
76 | "ddcutil can query and modify most external monitors' settings, such as | |
77 | brightness, colour levels, and input sources. Generally speaking, any setting | |
78 | that can be changed by pressing buttons on the monitor can be modified by | |
79 | ddcutil. | |
80 | ||
81 | ddcutil communicates directly with monitors implementing the Monitor Control | |
82 | Command Set (@dfn{MCCS}). It usually does so through the the Display Data | |
83 | Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also | |
84 | communicate over USB as per the USB Monitor Control Class Specification. | |
85 | ||
86 | One particular use case is in colour profile management. Monitor calibration | |
87 | is relative to the monitor colour settings currently in effect, e.g. red gain. | |
88 | ddcutil allows colour-related settings to be saved at the time a monitor is | |
89 | calibrated, and restored when the calibration is applied.") | |
90 | (license (list license:bsd-3 ; FindDDCUtil.cmake | |
91 | license:gpl2+)))) ; everything else | |
6e8c75b8 | 92 | |
8fe681b9 BW |
93 | (define-public edid-decode |
94 | (let ((commit "74b64180d67bb009d8d9ea1b6f18ad41aaa16396") ; 2020-04-22 | |
95 | (revision "1")) | |
96 | (package | |
97 | (name "edid-decode") | |
98 | (version (git-version "0.0.0" revision commit)) | |
99 | (source | |
100 | (origin | |
101 | (method git-fetch) | |
102 | (file-name (git-file-name name version)) | |
103 | (uri (git-reference | |
104 | (url "git://linuxtv.org/edid-decode.git") | |
105 | (commit commit))) | |
106 | (sha256 | |
107 | (base32 "0nirp5bza08zj5d8bjgcm0p869hdg3qg3mwa7999pjdrzmn7s2ah")))) | |
108 | (build-system gnu-build-system) | |
109 | (arguments | |
110 | `(#:tests? #f ; No test suite | |
111 | #:make-flags | |
112 | (list (string-append "DESTDIR=" (assoc-ref %outputs "out")) | |
113 | "bindir=/bin" "mandir=/share/man") | |
114 | #:phases | |
115 | (modify-phases %standard-phases | |
116 | (add-after 'unpack 'fix-cross-compilation | |
117 | (lambda* (#:key native-inputs target #:allow-other-keys) | |
118 | (when target | |
119 | (substitute* "Makefile" | |
120 | (("\\$\\(CXX\\)") | |
121 | (string-append target "-g++")))) | |
122 | #t)) | |
123 | (delete 'configure)))) | |
124 | (home-page "https://git.linuxtv.org/edid-decode.git/") | |
125 | (synopsis "Decode @dfn{EDID} data in human-readable format") | |
126 | (description "edid-decode decodes @dfn{EDID} monitor description data in | |
127 | human-readable format and checks if it conforms to the standards.") | |
128 | (license license:expat)))) | |
129 | ||
5eff4380 TGR |
130 | ;; Distinct from memtest86, which is obsolete. |
131 | (define-public memtest86+ | |
132 | (package | |
133 | (name "memtest86+") | |
134 | ;; Update the description when/if UEFI support is released. | |
135 | (version "5.01") | |
136 | (source | |
137 | (origin | |
138 | (method url-fetch) | |
139 | (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-" | |
140 | version ".tar.gz")) | |
141 | (sha256 | |
142 | (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l")))) | |
143 | (build-system gnu-build-system) | |
144 | (arguments | |
145 | `(#:system "i686-linux" ; the result runs outside of any OS | |
146 | #:tests? #f ; no way to test this | |
147 | #:phases | |
148 | (modify-phases %standard-phases | |
149 | (delete 'configure) ; no configure script | |
150 | (replace 'build | |
151 | ;; The default 'make all' does wonderful things, like scp(1) a file to | |
152 | ;; 192.168.0.12. Build the bootable images and nothing more. | |
153 | (lambda _ | |
154 | (invoke "make" | |
155 | "memtest" ; ELF executable | |
156 | "memtest.bin"))) ; DOS/MBR boot sector | |
157 | (replace 'install | |
158 | (lambda* (#:key outputs #:allow-other-keys) | |
159 | (let* ((out (assoc-ref outputs "out")) | |
160 | (lib (string-append out "/lib/memtest86+")) | |
161 | (doc (string-append out "/share/doc/memtest86+-" ,version))) | |
162 | (for-each | |
163 | (lambda (file) | |
164 | (install-file file lib)) | |
165 | (list "memtest" | |
166 | "memtest.bin")) | |
167 | (for-each | |
168 | (lambda (file) | |
169 | (install-file file doc)) | |
170 | (list "FAQ" | |
fb541251 TGR |
171 | "README")) |
172 | #t)))))) | |
5eff4380 TGR |
173 | (native-inputs |
174 | ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors. | |
175 | `(("gcc" ,gcc-4.9))) | |
176 | (supported-systems (list "i686-linux" "x86_64-linux")) | |
177 | (home-page "https://www.memtest.org/") | |
178 | (synopsis "Thorough real-mode memory tester") | |
179 | (description | |
180 | "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It | |
181 | repeatedly writes different patterns to all memory locations, reads them back | |
182 | again, and verifies whether the result is the same as what was written. This | |
183 | can help debug even intermittent and non-deterministic errors. | |
184 | ||
185 | It runs independently of any operating system, at computer boot-up, so that it | |
186 | can scan as much of your RAM as possible for hardware defects. | |
187 | ||
188 | Memtest86+ cannot currently be used on computers booted with UEFI.") | |
189 | (license license:gpl2))) | |
190 | ||
fb541251 TGR |
191 | (define-public memtester |
192 | (package | |
193 | (name "memtester") | |
194 | (version "4.3.0") | |
195 | (source | |
196 | (origin | |
197 | (method url-fetch) | |
198 | ;; Even the latest release is available under 'old-versions/'. | |
199 | (uri (string-append "http://pyropus.ca/software/memtester/old-versions/" | |
200 | "memtester-" version ".tar.gz")) | |
201 | (sha256 | |
202 | (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr")))) | |
203 | (build-system gnu-build-system) | |
204 | (arguments | |
205 | `(#:make-flags | |
206 | (list "CC=gcc") | |
207 | #:phases | |
208 | (modify-phases %standard-phases | |
209 | (replace 'configure | |
210 | ;; This is a home-brewed configuration system where the cc/ld command | |
211 | ;; lines are stored in one-line files. | |
212 | (lambda* (#:key outputs #:allow-other-keys) | |
213 | (let* ((out (assoc-ref outputs "out"))) | |
214 | (substitute* (list "conf-cc" "conf-ld") | |
215 | (("^cc") "gcc")) | |
216 | (substitute* "Makefile" | |
217 | (("(INSTALLPATH.*=).*" _ assignment) | |
218 | (string-append assignment out))) | |
219 | #t))) | |
220 | (replace 'check | |
221 | ;; There is no test suite. Test some RAM for a single iteration. | |
222 | (lambda _ | |
223 | (invoke "./memtester" "64K" "1")))))) | |
224 | (home-page "http://pyropus.ca/software/memtester/") | |
225 | (synopsis "User-space memory subsystem tester") | |
226 | (description | |
227 | "Memtester stress-tests the memory subsystem of your operating system and | |
228 | computer. It repeatedly writes different patterns to all memory locations, | |
229 | reads them back again, and verifies whether the result is the same as what was | |
230 | written. This can help debug even intermittent and non-deterministic errors. | |
231 | ||
232 | Memtester runs entirely in user space. This means that you don't need to reboot | |
233 | to test your memory, but also that it's not possible to test all of the RAM | |
234 | installed in the system. | |
235 | ||
236 | It can also be told to test memory starting at a particular physical address.") | |
237 | (license license:gpl2))) | |
238 | ||
6e8c75b8 TGR |
239 | (define-public msr-tools |
240 | (package | |
241 | (name "msr-tools") | |
242 | (version "1.3") | |
243 | (source | |
244 | (origin | |
245 | (method url-fetch) | |
246 | (uri (string-append "https://01.org/sites/default/files/downloads/" | |
247 | name "/" name "-" version ".zip")) | |
248 | (sha256 | |
249 | (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr")))) | |
250 | (build-system gnu-build-system) | |
251 | (arguments | |
252 | `(#:make-flags | |
253 | (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin")) | |
254 | #:phases | |
255 | (modify-phases %standard-phases | |
256 | (delete 'configure) ; no configure script | |
257 | (add-before 'install 'create-output-directory | |
258 | (lambda* (#:key outputs #:allow-other-keys) | |
259 | ;; 'make install' assumes that sbindir exists. | |
260 | (let* ((out (assoc-ref outputs "out")) | |
261 | (sbin (string-append out "/sbin"))) | |
262 | (mkdir-p sbin) | |
263 | #t)))) | |
264 | #:tests? #f)) ; no test suite | |
265 | (native-inputs | |
266 | `(("unzip" ,unzip))) | |
267 | ;; These registers and the CPUID instruction only exist on (most) x86 chips. | |
268 | (supported-systems (list "i686-linux" "x86_64-linux")) | |
269 | (home-page "https://01.org/msr-tools/") | |
270 | (synopsis "Read and write Model-Specific Registers (@dfn{MSR})") | |
271 | (description | |
272 | "The MSR Tools project provides console utilities to directly access the | |
273 | Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors: | |
274 | ||
275 | @itemize | |
276 | @item @command{cpuid}: show identification and feature information of any CPU | |
277 | @item @command{rdmsr}: read MSRs from any CPU or all CPUs | |
278 | @item @command{wrmsr}: write to MSRs on any CPU or all CPUs | |
279 | @end itemize | |
280 | ||
281 | These tools can be used to query and modify certain low-level CPU parameters, | |
282 | such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits. | |
283 | ||
284 | MSR addresses differ (greatly) between processors, and any such modification can | |
285 | be dangerous and may void your CPU or system board's warranty.") | |
286 | (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+ | |
0ba0ab81 TGR |
287 | |
288 | (define-public wavemon | |
289 | (package | |
290 | (name "wavemon") | |
5976d0b0 | 291 | (version "0.9.1") |
0ba0ab81 TGR |
292 | (source |
293 | (origin | |
294 | (method git-fetch) | |
295 | (uri (git-reference | |
296 | (url "https://github.com/uoaerg/wavemon.git") | |
297 | (commit (string-append "v" version)))) | |
298 | (file-name (git-file-name name version)) | |
299 | (sha256 | |
5976d0b0 | 300 | (base32 "109ycwnjjqc2vpnd8b86njfifczlxglnyv4rh2qmbn2i5nw2wryg")))) |
0ba0ab81 TGR |
301 | (build-system gnu-build-system) |
302 | (arguments | |
303 | `(#:make-flags | |
304 | (list "CC=gcc" | |
305 | ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's | |
306 | ;; standard --docdir since it's only used as such. | |
307 | (string-append "datadir=" (assoc-ref %outputs "out") | |
308 | "/share/doc/" ,name "-" ,version)) | |
309 | #:tests? #f)) ; no tests | |
310 | (native-inputs | |
311 | `(("pkg-config" ,pkg-config))) | |
312 | (inputs | |
313 | `(("libcap" ,libcap) | |
314 | ("libnl" ,libnl) | |
315 | ("ncurses" ,ncurses))) | |
316 | (home-page "https://github.com/uoaerg/wavemon") | |
317 | (synopsis "Wireless network device monitor") | |
318 | (description | |
319 | "Wavemon is a wireless device monitor with an interactive ncurses terminal | |
320 | interface. It can display and plot signal and noise levels in real time. It | |
321 | also reports packet statistics, device configuration, network parameters, and | |
322 | access points and other wireless clients of your wireless network hardware. | |
323 | ||
324 | Wavemon should work (with varying levels of detail and features) with any device | |
325 | supported by the Linux kernel.") | |
326 | ;; Source file headers still say GPL2+, but the authorial intent | |
327 | ;; (from COPYING and the F9 'about' screen) is clearly GPL3+. | |
328 | (license license:gpl3+))) | |
22a98cda JN |
329 | |
330 | (define-public rkdeveloptool | |
331 | (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3") | |
332 | (revision "0")) | |
333 | (package | |
334 | (name "rkdeveloptool") | |
335 | (version (git-version "1.3" revision commit)) | |
336 | (source | |
337 | (origin | |
338 | (method git-fetch) | |
339 | (uri (git-reference | |
340 | (url "https://github.com/rockchip-linux/rkdeveloptool.git") | |
341 | (commit commit))) | |
342 | (file-name (git-file-name name version)) | |
343 | (sha256 | |
344 | (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga")))) | |
345 | (build-system gnu-build-system) | |
346 | (native-inputs | |
347 | `(("autoconf" ,autoconf) | |
348 | ("automake" ,automake) | |
349 | ("pkg-config" ,pkg-config))) | |
350 | (inputs | |
351 | `(("libusb" ,libusb))) | |
352 | (home-page "https://github.com/rockchip-linux/rkdeveloptool") | |
353 | (synopsis "Read from and write to RockChicp devices over USB") | |
354 | (description | |
355 | "Rkdeveloptool can read from and write to RockChip devices over USB, such | |
356 | as the Pinebook Pro.") | |
357 | (license license:gpl2+)))) | |
22df0a1f BW |
358 | |
359 | (define-public libqb | |
360 | (package | |
361 | (name "libqb") | |
362 | ;; NOTE: We are using a Release Candidate version (for 2.0) here because | |
363 | ;; of the linker issues with the previous release. | |
364 | (version "1.9.1") | |
365 | (source (origin | |
366 | (method url-fetch) | |
367 | (uri (string-append | |
368 | "https://github.com/ClusterLabs/libqb/releases/download/v" | |
369 | version "/libqb-" version ".tar.xz")) | |
370 | (sha256 | |
371 | (base32 | |
372 | "008vvw504kh40br5v2xkqavnp9vpmjvf768faqzv1d00fd53ingn")))) | |
373 | (build-system gnu-build-system) | |
374 | (native-inputs | |
375 | `(("pkg-config" ,pkg-config) | |
376 | ("xmllint" ,libxml2))) | |
377 | (home-page "https://clusterlabs.github.io/libqb/") | |
378 | (synopsis "Library providing high performance logging, tracing, ipc, and poll") | |
379 | (description "Libqb is a library with the primary purpose of providing | |
380 | high-performance, reusable features for client-server architecture, such as | |
381 | logging, tracing, inter-process communication (IPC), and polling. Libqb is | |
382 | not intended to be an all-encompassing library, but instead provide focused | |
383 | APIs that are highly tuned for maximum performance for client-server | |
384 | applications.") | |
385 | (license license:lgpl2.1))) | |
02ee43e4 BW |
386 | |
387 | (define-public usbguard | |
388 | (package | |
389 | (name "usbguard") | |
390 | (version "0.7.6") | |
391 | (source (origin | |
392 | (method url-fetch) | |
393 | (uri (string-append | |
394 | "https://github.com/USBGuard/usbguard/releases/download/usbguard-" | |
395 | version "/usbguard-" version ".tar.gz")) | |
396 | (file-name (git-file-name name version)) | |
397 | (sha256 | |
398 | (base32 "0gzhs8s4aka86mkcjib36z54si939ki4bmk46p6v8kln1fixad3j")))) | |
399 | (build-system gnu-build-system) | |
400 | (arguments | |
401 | `(#:phases | |
402 | (modify-phases %standard-phases | |
f96ddb60 BW |
403 | (add-after 'unpack 'patch-build-scripts |
404 | (lambda* (#:key inputs #:allow-other-keys) | |
405 | (substitute* "configure" | |
406 | (("/usr/include/catch") | |
407 | (string-append (assoc-ref inputs "catch") "/include"))) | |
02ee43e4 | 408 | ;; Do not create log directory. |
f96ddb60 | 409 | (substitute* "Makefile.in" ((".*/log/usbguard.*") "")) |
02ee43e4 | 410 | ;; Disable LDAP tests: they use 'sudo'. |
f96ddb60 BW |
411 | (substitute* "src/Tests/Makefile.in" |
412 | (("\\$\\(am__append_2\\)") "")) | |
02ee43e4 BW |
413 | #t)) |
414 | (add-after 'install 'delete-static-library | |
415 | (lambda* (#:key outputs #:allow-other-keys) | |
416 | ;; It can't be direclty disabled since it's needed for the tests. | |
417 | (delete-file (string-append (assoc-ref outputs "out") | |
418 | "/lib/libusbguard.a")) | |
419 | #t)) | |
420 | (add-after 'install 'install-zsh-completion | |
421 | (lambda* (#:key outputs #:allow-other-keys) | |
422 | (let* ((out (assoc-ref outputs "out")) | |
423 | (site-functions | |
424 | (string-append out "/share/zsh/site-functions"))) | |
425 | (mkdir-p site-functions) | |
426 | (copy-file "scripts/usbguard-zsh-completion" | |
427 | (string-append site-functions "/_usbguard")) | |
428 | #t)))) | |
429 | #:make-flags | |
430 | (list (string-append "BASH_COMPLETION_DIR=" | |
431 | (assoc-ref %outputs "out") | |
432 | "/etc/bash_completion.d")) | |
433 | #:configure-flags | |
434 | (list | |
435 | "--localstatedir=/var" | |
02ee43e4 BW |
436 | "--enable-systemd=no" |
437 | "--with-ldap" | |
438 | "--with-dbus" | |
439 | "--with-polkit"))) | |
440 | (inputs | |
441 | `(("audit" ,audit) | |
442 | ("catch" ,catch-framework) | |
443 | ("dbus-glib" ,dbus-glib) | |
444 | ("ldap" ,openldap) | |
445 | ("libcap-ng" ,libcap-ng) | |
446 | ("libseccomp" ,libseccomp) | |
447 | ("libsodium" ,libsodium) | |
febd19da | 448 | ("pegtl" ,pegtl) |
02ee43e4 BW |
449 | ("polkit" ,polkit) |
450 | ("protobuf" ,protobuf) | |
451 | ("libqb" ,libqb))) | |
452 | (native-inputs | |
453 | `(("asciidoc" ,asciidoc) | |
02ee43e4 BW |
454 | ("bash-completion" ,bash-completion) |
455 | ("gdbus-codegen" ,glib "bin") | |
456 | ("umockdev" ,umockdev) | |
457 | ("xmllint" ,libxml2) | |
458 | ("xsltproc" ,libxslt) | |
459 | ("pkg-config" ,pkg-config))) | |
460 | (home-page "https://usbguard.github.io") | |
461 | (synopsis "Helps to protect your computer against rogue USB devices (a.k.a. BadUSB)") | |
462 | (description "USBGuard is a software framework for implementing USB device | |
463 | authorization policies (what kind of USB devices are authorized) as well as | |
464 | method of use policies (how a USB device may interact with the system). | |
465 | Simply put, it is a USB device whitelisting tool.") | |
466 | (license license:gpl2))) |