b484c4d549bebd639dad52ef31d310a5a3fd46b9
[jackhill/guix/guix.git] / gnu / packages / linux.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
8 ;;; Copyright © 2015, 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
10 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
12 ;;; Copyright © 2016 Raymond Nicholson <rain1@openmailbox.org>
13 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
14 ;;; Copyright © 2016, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
15 ;;; Copyright © 2016, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
16 ;;; Copyright © 2016 David Craven <david@craven.ch>
17 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
18 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
19 ;;; Copyright © 2016, 2018 Rene Saavedra <pacoon@protonmail.com>
20 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
21 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
22 ;;; Copyright © 2017, 2018, 2020 Leo Famulari <leo@famulari.name>
23 ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.com>
24 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
25 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
26 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
27 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
28 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
29 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
30 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
31 ;;; Copyright © 2018, 2020 Brendan Tildesley <mail@brendan.scot>
32 ;;; Copyright © 2018 Manuel Graf <graf@init.at>
33 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
34 ;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
35 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
36 ;;; Copyright © 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
37 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
38 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
39 ;;; Copyright © 2019, 2020 Brice Waegeneire <brice@waegenei.re>
40 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
41 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
42 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
43 ;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
44 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
45 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
46 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
47 ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
48 ;;; Copyright © 2020 John Soo <jsoo1@asu.edu>
49 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
50 ;;; Copyright © 2020 Anders Thuné <asse.97@gmail.com>
51 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
52 ;;;
53 ;;; This file is part of GNU Guix.
54 ;;;
55 ;;; GNU Guix is free software; you can redistribute it and/or modify it
56 ;;; under the terms of the GNU General Public License as published by
57 ;;; the Free Software Foundation; either version 3 of the License, or (at
58 ;;; your option) any later version.
59 ;;;
60 ;;; GNU Guix is distributed in the hope that it will be useful, but
61 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
62 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 ;;; GNU General Public License for more details.
64 ;;;
65 ;;; You should have received a copy of the GNU General Public License
66 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
67
68 (define-module (gnu packages linux)
69 #:use-module (gnu packages)
70 #:use-module (gnu packages acl)
71 #:use-module (gnu packages admin)
72 #:use-module (gnu packages algebra)
73 #:use-module (gnu packages audio)
74 #:use-module (gnu packages autotools)
75 #:use-module (gnu packages backup)
76 #:use-module (gnu packages base)
77 #:use-module (gnu packages bash)
78 #:use-module (gnu packages bison)
79 #:use-module (gnu packages boost)
80 #:use-module (gnu packages calendar)
81 #:use-module (gnu packages check)
82 #:use-module (gnu packages cpio)
83 #:use-module (gnu packages crypto)
84 #:use-module (gnu packages cryptsetup)
85 #:use-module (gnu packages compression)
86 #:use-module (gnu packages dbm)
87 #:use-module (gnu packages datastructures)
88 #:use-module (gnu packages docbook)
89 #:use-module (gnu packages documentation)
90 #:use-module (gnu packages elf)
91 #:use-module (gnu packages flex)
92 #:use-module (gnu packages file)
93 #:use-module (gnu packages freedesktop)
94 #:use-module (gnu packages gawk)
95 #:use-module (gnu packages gcc)
96 #:use-module (gnu packages gettext)
97 #:use-module (gnu packages glib)
98 #:use-module (gnu packages golang)
99 #:use-module (gnu packages gperf)
100 #:use-module (gnu packages gstreamer)
101 #:use-module (gnu packages gtk)
102 #:use-module (gnu packages haskell-apps)
103 #:use-module (gnu packages haskell-xyz)
104 #:use-module (gnu packages libunwind)
105 #:use-module (gnu packages libusb)
106 #:use-module (gnu packages llvm)
107 #:use-module (gnu packages lua)
108 #:use-module (gnu packages man)
109 #:use-module (gnu packages maths)
110 #:use-module (gnu packages multiprecision)
111 #:use-module (gnu packages ncurses)
112 #:use-module (gnu packages netpbm)
113 #:use-module (gnu packages networking)
114 #:use-module (gnu packages ninja)
115 #:use-module (gnu packages nss)
116 #:use-module (gnu packages perl)
117 #:use-module (gnu packages pciutils)
118 #:use-module (gnu packages pkg-config)
119 #:use-module (gnu packages popt)
120 #:use-module (gnu packages pulseaudio)
121 #:use-module (gnu packages python)
122 #:use-module (gnu packages python-xyz)
123 #:use-module (gnu packages readline)
124 #:use-module (gnu packages rrdtool)
125 #:use-module (gnu packages samba)
126 #:use-module (gnu packages sdl)
127 #:use-module (gnu packages serialization)
128 #:use-module (gnu packages slang)
129 #:use-module (gnu packages texinfo)
130 #:use-module (gnu packages tls)
131 #:use-module (gnu packages valgrind)
132 #:use-module (gnu packages video)
133 #:use-module (gnu packages vulkan)
134 #:use-module (gnu packages web)
135 #:use-module (gnu packages xiph)
136 #:use-module (gnu packages xml)
137 #:use-module (gnu packages xdisorg)
138 #:use-module (gnu packages xorg)
139 #:use-module (gnu packages groff)
140 #:use-module (gnu packages rsync)
141 #:use-module (gnu packages selinux)
142 #:use-module (gnu packages swig)
143 #:use-module (guix build-system cmake)
144 #:use-module (guix build-system gnu)
145 #:use-module (guix build-system go)
146 #:use-module (guix build-system meson)
147 #:use-module (guix build-system python)
148 #:use-module (guix build-system trivial)
149 #:use-module (guix build-system linux-module)
150 #:use-module (guix download)
151 #:use-module (guix git-download)
152 #:use-module ((guix licenses) #:prefix license:)
153 #:use-module (guix packages)
154 #:use-module (guix gexp)
155 #:use-module (guix store)
156 #:use-module (guix monads)
157 #:use-module (guix utils)
158 #:use-module (srfi srfi-1)
159 #:use-module (srfi srfi-2)
160 #:use-module (srfi srfi-26)
161 #:use-module (ice-9 match))
162
163 (define-public (system->linux-architecture arch)
164 "Return the Linux architecture name for ARCH, a Guix system name such as
165 \"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
166 (let ((arch (car (string-split arch #\-))))
167 (cond ((string=? arch "i686") "i386")
168 ((string-prefix? "mips" arch) "mips")
169 ((string-prefix? "arm" arch) "arm")
170 ((string-prefix? "aarch64" arch) "arm64")
171 ((string-prefix? "alpha" arch) "alpha")
172 ((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le"
173 ((string-prefix? "s390" arch) "s390")
174 ((string-prefix? "riscv" arch) "riscv")
175 (else arch))))
176
177 (define-public (system->defconfig system)
178 "Some systems (notably powerpc-linux) require a special target for kernel
179 defconfig. Return the appropriate make target if applicable, otherwise return
180 \"defconfig\"."
181 (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
182 ((string-prefix? "powerpc64le-" system) "ppc64_defconfig")
183 (else "defconfig")))
184
185 \f
186 ;;;
187 ;;; Kernel source code deblobbing.
188 ;;;
189
190 (define (linux-libre-deblob-scripts version
191 deblob-hash
192 deblob-check-hash)
193 (list (version-major+minor version)
194 (origin
195 (method url-fetch)
196 (uri (string-append "https://linux-libre.fsfla.org"
197 "/pub/linux-libre/releases/" version "-gnu/"
198 "deblob-" (version-major+minor version)))
199 (file-name (string-append "linux-libre-deblob-"
200 (version-major+minor version)))
201 (sha256 deblob-hash))
202 (origin
203 (method url-fetch)
204 (uri (string-append "https://linux-libre.fsfla.org"
205 "/pub/linux-libre/releases/" version "-gnu/"
206 "deblob-check"))
207 (file-name (string-append "linux-libre-deblob-check-"
208 (version-major+minor version)))
209 (sha256 deblob-check-hash))))
210
211 (define deblob-scripts-5.8
212 (linux-libre-deblob-scripts
213 "5.8.7"
214 (base32 "07z7sglyrfh0706icqqf3shadf638pvyid9386r661ds5lbsa2mw")
215 (base32 "0j6jba5fcddqlb42f95gjl78jisfla4nswqila074gglcrbnl9q7")))
216
217 (define deblob-scripts-5.4
218 (linux-libre-deblob-scripts
219 "5.4.63"
220 (base32 "0ckxn7k5zgcqk30dq943bnamr6a6zjbw2aqjl3x30f4kvh5f6k25")
221 (base32 "1b3q88i2qfdxyvpi9f7jds0qlb8hfpw87mgia096ax6822c2cmyb")))
222
223 (define deblob-scripts-4.19
224 (linux-libre-deblob-scripts
225 "4.19.143"
226 (base32 "02zs405awaxydbapka4nz8h6lmnc0dahgczqsrs5s2bmzjyyqkcy")
227 (base32 "1jiaw0as1ippkrjdpd52657w5mz9qczg3y2hlra7m9k0xawwiqlf")))
228
229 (define deblob-scripts-4.14
230 (linux-libre-deblob-scripts
231 "4.14.196"
232 (base32 "091jk9jkn9jf39bxpc7395bhcb7p96nkg3a8047380ki06lnfxh6")
233 (base32 "1qij18inijj6c3ma8hv98yjagnzxdxyn134da9fd23ky8q6hbvky")))
234
235 (define deblob-scripts-4.9
236 (linux-libre-deblob-scripts
237 "4.9.235"
238 (base32 "1wvldzlv7q2xdbadas87dh593nxr4a8p5n0f8zpm72lja6w18hmg")
239 (base32 "0fxajshb75siq39lj5h8xvhdj8lcmddkslwlyj65rhlwk6g2r4b2")))
240
241 (define deblob-scripts-4.4
242 (linux-libre-deblob-scripts
243 "4.4.235"
244 (base32 "0x2j1i88am54ih2mk7gyl79g25l9zz4r08xhl482l3fvjj2irwbw")
245 (base32 "0hhin1jpfkd6nwrb6xqxjzl3hdxy4pn8a15hy2d3d83yw6pflbsf")))
246
247 (define* (computed-origin-method gexp-promise hash-algo hash
248 #:optional (name "source")
249 #:key (system (%current-system))
250 (guile (default-guile)))
251 "Return a derivation that executes the G-expression that results
252 from forcing GEXP-PROMISE."
253 (mlet %store-monad ((guile (package->derivation guile system)))
254 (gexp->derivation (or name "computed-origin")
255 (force gexp-promise)
256 #:graft? #f ;nothing to graft
257 #:system system
258 #:guile-for-build guile)))
259
260 (define (make-linux-libre-source version
261 upstream-source
262 deblob-scripts)
263 "Return a 'computed' origin that generates a Linux-libre tarball from the
264 corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS."
265 (match deblob-scripts
266 ((deblob-version (? origin? deblob) (? origin? deblob-check))
267 (unless (string=? deblob-version (version-major+minor version))
268 ;; The deblob script cannot be expected to work properly on a
269 ;; different version (major+minor) of Linux, even if no errors
270 ;; are signaled during execution.
271 (error "deblob major+minor version mismatch"))
272 (origin
273 (method computed-origin-method)
274 (file-name (string-append "linux-libre-" version "-guix.tar.xz"))
275 (sha256 #f)
276 (uri
277 (delay
278 (with-imported-modules '((guix build utils))
279 #~(begin
280 (use-modules (guix build utils)
281 (srfi srfi-1)
282 (ice-9 match)
283 (ice-9 ftw))
284
285 (setvbuf (current-output-port) 'line)
286
287 (let ((dir (string-append "linux-" #$version)))
288
289 (mkdir "/tmp/bin")
290 (set-path-environment-variable
291 "PATH" '("bin")
292 (list "/tmp"
293 #+(canonical-package bash)
294 #+(canonical-package coreutils)
295 #+(canonical-package diffutils)
296 #+(canonical-package findutils)
297 #+(canonical-package patch)
298 #+(canonical-package xz)
299 #+(canonical-package sed)
300 #+(canonical-package grep)
301 #+(canonical-package bzip2)
302 #+(canonical-package gzip)
303 #+(canonical-package tar)
304 #+(canonical-package gawk)
305 #+python-wrapper))
306
307 (with-directory-excursion "/tmp/bin"
308
309 (copy-file #+deblob "deblob")
310 (chmod "deblob" #o755)
311 (substitute* "deblob"
312 (("/bin/sh") (which "sh")))
313
314 (copy-file #+deblob-check "deblob-check")
315 (chmod "deblob-check" #o755)
316 (substitute* "deblob-check"
317 (("/bin/sh") (which "sh"))
318 (("/bin/sed") (which "sed"))
319 (("/usr/bin/python") (which "python"))))
320
321 (if (file-is-directory? #+upstream-source)
322 (begin
323 (format #t "Copying upstream linux source...~%")
324 (invoke "cp" "--archive" #+upstream-source dir)
325 (invoke "chmod" "--recursive" "u+w" dir))
326 (begin
327 (format #t "Unpacking upstream linux tarball...~%")
328 (invoke "tar" "xf" #$upstream-source)
329 (match (scandir "."
330 (lambda (name)
331 (and (not (member name '("." "..")))
332 (file-is-directory? name))))
333 ((unpacked-dir)
334 (unless (string=? dir unpacked-dir)
335 (rename-file unpacked-dir dir)))
336 (dirs
337 (error "multiple directories found" dirs)))))
338
339 (with-directory-excursion dir
340 (format #t "Running deblob script...~%")
341 (invoke "/tmp/bin/deblob"))
342
343 (format #t "~%Packing new Linux-libre tarball...~%")
344 (invoke "tar" "cvfa" #$output
345 ;; Avoid non-determinism in the archive.
346 "--mtime=@0"
347 "--owner=root:0"
348 "--group=root:0"
349 "--sort=name"
350 "--hard-dereference"
351 dir)
352
353 (format #t "~%Scanning the generated tarball for blobs...~%")
354 (invoke "/tmp/bin/deblob-check" "--use-awk" "--list-blobs"
355 #$output))))))))))
356
357 \f
358 ;;;
359 ;;; Kernel sources.
360 ;;;
361
362 (define (linux-libre-urls version)
363 "Return a list of URLs for Linux-Libre VERSION."
364 (list (string-append
365 "https://linux-libre.fsfla.org/pub/linux-libre/releases/"
366 version "-gnu/linux-libre-" version "-gnu.tar.xz")
367
368 ;; XXX: Work around <http://bugs.gnu.org/14851>.
369 (string-append
370 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
371 version "-gnu.tar.xz")
372
373 ;; Maybe this URL will become valid eventually.
374 (string-append
375 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
376 version "-gnu.tar.xz")))
377
378 (define (%upstream-linux-source version hash)
379 (origin
380 (method url-fetch)
381 (uri (string-append "mirror://kernel.org"
382 "/linux/kernel/v" (version-major version) ".x/"
383 "linux-" version ".tar.xz"))
384 (sha256 hash)))
385
386
387 (define-public linux-libre-5.8-version "5.8.7")
388 (define-public linux-libre-5.8-pristine-source
389 (let ((version linux-libre-5.8-version)
390 (hash (base32 "1zhpzlhl2ykna2nc70m72wlgyv1pkvkpfssb4k8p5pwlkh1ga2vv")))
391 (make-linux-libre-source version
392 (%upstream-linux-source version hash)
393 deblob-scripts-5.8)))
394
395 (define-public linux-libre-5.4-version "5.4.63")
396 (define-public linux-libre-5.4-pristine-source
397 (let ((version linux-libre-5.4-version)
398 (hash (base32 "1h7zlzylxql2v6hyi6g141kj5r3frk2xk6i8lfqn64d01np0s9p0")))
399 (make-linux-libre-source version
400 (%upstream-linux-source version hash)
401 deblob-scripts-5.4)))
402
403 (define-public linux-libre-4.19-version "4.19.143")
404 (define-public linux-libre-4.19-pristine-source
405 (let ((version linux-libre-4.19-version)
406 (hash (base32 "1383yfwb962mhn25b3b3zqrwnpyp01g5xclsv14wra0fdz33ahra")))
407 (make-linux-libre-source version
408 (%upstream-linux-source version hash)
409 deblob-scripts-4.19)))
410
411 (define-public linux-libre-4.14-version "4.14.196")
412 (define-public linux-libre-4.14-pristine-source
413 (let ((version linux-libre-4.14-version)
414 (hash (base32 "16mhqymwkgqi8zalcij5c754smc8ysvfw6l2cwshr4scipsv4qay")))
415 (make-linux-libre-source version
416 (%upstream-linux-source version hash)
417 deblob-scripts-4.14)))
418
419 (define-public linux-libre-4.9-version "4.9.235")
420 (define-public linux-libre-4.9-pristine-source
421 (let ((version linux-libre-4.9-version)
422 (hash (base32 "1hqcb3zw4546h6x5xy2mywdznha8813lx15mxbgfbvwm4qhsc9g6")))
423 (make-linux-libre-source version
424 (%upstream-linux-source version hash)
425 deblob-scripts-4.9)))
426
427 (define-public linux-libre-4.4-version "4.4.235")
428 (define-public linux-libre-4.4-pristine-source
429 (let ((version linux-libre-4.4-version)
430 (hash (base32 "0w5pkv936zb0shjgnpv17gcp5n8f91djznzq54p6j1bl5q2qdyqd")))
431 (make-linux-libre-source version
432 (%upstream-linux-source version hash)
433 deblob-scripts-4.4)))
434
435 (define %boot-logo-patch
436 ;; Linux-Libre boot logo featuring Freedo and a gnu.
437 (origin
438 (method url-fetch)
439 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
440 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
441 (sha256
442 (base32
443 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
444
445 (define %linux-libre-arm-export-__sync_icache_dcache-patch
446 (origin
447 (method url-fetch)
448 (uri (string-append
449 "https://salsa.debian.org/kernel-team/linux"
450 "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0"
451 "/debian/patches/bugfix/arm/"
452 "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch"))
453 (file-name "linux-libre-arm-export-__sync_icache_dcache.patch")
454 (sha256
455 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f"))))
456
457 (define (source-with-patches source patches)
458 (origin
459 (inherit source)
460 (patches (append (origin-patches source)
461 patches))))
462
463 (define-public linux-libre-5.8-source
464 (source-with-patches linux-libre-5.8-pristine-source
465 (list %boot-logo-patch
466 %linux-libre-arm-export-__sync_icache_dcache-patch)))
467
468 (define-public linux-libre-5.4-source
469 (source-with-patches linux-libre-5.4-pristine-source
470 (list %boot-logo-patch
471 %linux-libre-arm-export-__sync_icache_dcache-patch
472 ;; Pinebook Pro patch from linux-next,
473 ;; can be dropped for linux-libre 5.7
474 (search-patch
475 "linux-libre-support-for-Pinebook-Pro.patch"))))
476
477 (define-public linux-libre-4.19-source
478 (source-with-patches linux-libre-4.19-pristine-source
479 (list %boot-logo-patch
480 %linux-libre-arm-export-__sync_icache_dcache-patch)))
481
482 (define-public linux-libre-4.14-source
483 (source-with-patches linux-libre-4.14-pristine-source
484 (list %boot-logo-patch)))
485
486 (define-public linux-libre-4.9-source
487 (source-with-patches linux-libre-4.9-pristine-source
488 (list %boot-logo-patch)))
489
490 (define-public linux-libre-4.4-source
491 (source-with-patches linux-libre-4.4-pristine-source
492 (list %boot-logo-patch)))
493
494 \f
495 ;;;
496 ;;; Kernel headers.
497 ;;;
498
499 (define (make-linux-libre-headers version hash-string)
500 (make-linux-libre-headers* version
501 (origin
502 (method url-fetch)
503 (uri (linux-libre-urls version))
504 (sha256 (base32 hash-string)))))
505
506 (define (make-linux-libre-headers* version source)
507 (package
508 (name "linux-libre-headers")
509 (version version)
510 (source source)
511 (build-system gnu-build-system)
512 (native-inputs `(("perl" ,perl)
513 ,@(if (version>=? version "4.16")
514 `(("flex" ,flex)
515 ("bison" ,bison))
516 '())
517 ,@(if (version>=? version "5.3")
518 `(("rsync" ,rsync))
519 '())))
520 (arguments
521 `(#:modules ((guix build gnu-build-system)
522 (guix build utils)
523 (srfi srfi-1))
524 #:phases
525 (modify-phases %standard-phases
526 (delete 'configure)
527 (replace 'build
528 (lambda _
529 (let ((arch ,(system->linux-architecture
530 (or (%current-target-system)
531 (%current-system))))
532 (defconfig ,(system->defconfig
533 (or (%current-target-system)
534 (%current-system)))))
535 (setenv "ARCH" arch)
536 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
537 (invoke "make" defconfig)
538 (invoke "make" "mrproper" "headers_check"))))
539 (replace 'install
540 (lambda* (#:key outputs #:allow-other-keys)
541 (let ((out (assoc-ref outputs "out")))
542 (invoke "make"
543 (string-append "INSTALL_HDR_PATH=" out)
544 "headers_install")
545
546 (mkdir (string-append out "/include/config"))
547 (call-with-output-file
548 (string-append out
549 "/include/config/kernel.release")
550 (lambda (p)
551 (format p "~a-default~%" ,version)))
552
553 ;; Remove the '.install' and '..install.cmd' files; the
554 ;; latter contains store paths, which pulls in bootstrap
555 ;; binaries in the build environment, and prevents bit
556 ;; reproducibility for the bootstrap binaries.
557 (for-each delete-file (find-files out "\\.install"))
558
559 #t))))
560 #:allowed-references ()
561 #:tests? #f))
562 (home-page "https://www.gnu.org/software/linux-libre/")
563 (synopsis "GNU Linux-Libre kernel headers")
564 (description "Headers of the Linux-Libre kernel.")
565 (license license:gpl2)))
566
567 (define-public linux-libre-headers-5.8
568 (make-linux-libre-headers* linux-libre-5.8-version
569 linux-libre-5.8-source))
570
571 (define-public linux-libre-headers-5.4
572 (make-linux-libre-headers* linux-libre-5.4-version
573 linux-libre-5.4-source))
574
575 (define-public linux-libre-headers-4.19
576 (make-linux-libre-headers* linux-libre-4.19-version
577 linux-libre-4.19-source))
578
579 (define-public linux-libre-headers-4.14
580 (make-linux-libre-headers* linux-libre-4.14-version
581 linux-libre-4.14-source))
582
583 (define-public linux-libre-headers-4.9
584 (make-linux-libre-headers* linux-libre-4.9-version
585 linux-libre-4.9-source))
586
587 (define-public linux-libre-headers-4.4
588 (make-linux-libre-headers* linux-libre-4.4-version
589 linux-libre-4.4-source))
590
591 ;; The following package is used in the early bootstrap, and thus must be kept
592 ;; stable and with minimal build requirements.
593 (define-public linux-libre-headers-5.4.20
594 (make-linux-libre-headers "5.4.20"
595 "1qxhf6dmcwjblzx8fgn6vr10p38xw10iwh6d1y1v1mxb25y30b47"))
596
597 (define-public linux-libre-headers linux-libre-headers-5.4.20)
598
599 \f
600 ;;;
601 ;;; Kernel configurations.
602 ;;;
603
604 (define* (kernel-config arch #:key variant)
605 "Return the absolute file name of the Linux-Libre build configuration file
606 for ARCH and optionally VARIANT, or #f if there is no such configuration."
607 (let* ((name (string-append (if variant (string-append variant "-") "")
608 (if (string=? "i386" arch) "i686" arch) ".conf"))
609 (file (string-append "linux-libre/" name)))
610 (search-auxiliary-file file)))
611
612 (define %default-extra-linux-options
613 `(;; Some very mild hardening.
614 ("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
615 ;; All kernels should have NAMESPACES options enabled
616 ("CONFIG_NAMESPACES" . #t)
617 ("CONFIG_UTS_NS" . #t)
618 ("CONFIG_IPC_NS" . #t)
619 ("CONFIG_USER_NS" . #t)
620 ("CONFIG_PID_NS" . #t)
621 ("CONFIG_NET_NS" . #t)
622 ;; Various options needed for elogind service:
623 ;; https://issues.guix.gnu.org/43078
624 ("CONFIG_CGROUP_FREEZER" . #t)
625 ("CONFIG_BLK_CGROUP" . #t)
626 ("CONFIG_CGROUP_WRITEBACK" . #t)
627 ("CONFIG_CGROUP_SCHED" . #t)
628 ("CONFIG_CGROUP_PIDS" . #t)
629 ("CONFIG_CGROUP_FREEZER" . #t)
630 ("CONFIG_CGROUP_DEVICE" . #t)
631 ("CONFIG_CGROUP_CPUACCT" . #t)
632 ("CONFIG_CGROUP_PERF" . #t)
633 ("CONFIG_SOCK_CGROUP_DATA" . #t)
634 ("CONFIG_BLK_CGROUP_IOCOST" . #t)
635 ("CONFIG_CGROUP_NET_PRIO" . #t)
636 ("CONFIG_CGROUP_NET_CLASSID" . #t)
637 ("CONFIG_MEMCG" . #t)
638 ("CONFIG_MEMCG_SWAP" . #t)
639 ("CONFIG_MEMCG_KMEM" . #t)
640 ("CONFIG_CPUSETS" . #t)
641 ("CONFIG_PROC_PID_CPUSET" . #t)
642 ;; Modules required for initrd:
643 ("CONFIG_NET_9P" . m)
644 ("CONFIG_NET_9P_VIRTIO" . m)
645 ("CONFIG_VIRTIO_BLK" . m)
646 ("CONFIG_VIRTIO_NET" . m)
647 ("CONFIG_VIRTIO_PCI" . m)
648 ("CONFIG_VIRTIO_BALLOON" . m)
649 ("CONFIG_VIRTIO_MMIO" . m)
650 ("CONFIG_FUSE_FS" . m)
651 ("CONFIG_CIFS" . m)
652 ("CONFIG_9P_FS" . m)))
653
654 ;; See https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration
655 (define %bpf-extra-linux-options
656 `(;; Needed for probes
657 ("CONFIG_UPROBE_EVENTS" . #t)
658 ("CONFIG_KPROBE_EVENTS" . #t)
659 ;; kheaders module also helpful for tracing
660 ("CONFIG_IKHEADERS" . #t)
661 ("CONFIG_BPF" . #t)
662 ("CONFIG_BPF_SYSCALL" . #t)
663 ("CONFIG_BPF_JIT_ALWAYS_ON" . #t)
664 ;; optional, for tc filters
665 ("CONFIG_NET_CLS_BPF" . m)
666 ;; optional, for tc actions
667 ("CONFIG_NET_ACT_BPF" . m)
668 ("CONFIG_BPF_JIT" . #t)
669 ;; for Linux kernel versions 4.1 through 4.6
670 ;; ("CONFIG_HAVE_BPF_JIT" . y)
671 ;; for Linux kernel versions 4.7 and later
672 ("CONFIG_HAVE_EBPF_JIT" . #t)
673 ;; optional, for kprobes
674 ("CONFIG_BPF_EVENTS" . #t)
675 ;; kheaders module
676 ("CONFIG_IKHEADERS" . #t)))
677
678 (define (config->string options)
679 (string-join (map (match-lambda
680 ((option . 'm)
681 (string-append option "=m"))
682 ((option . #t)
683 (string-append option "=y"))
684 ((option . #f)
685 (string-append option "=n")))
686 options)
687 "\n"))
688
689 \f
690 ;;;
691 ;;; Kernel package utilities.
692 ;;;
693
694 (define* (make-linux-libre version hash-string supported-systems
695 #:key
696 ;; A function that takes an arch and a variant.
697 ;; See kernel-config for an example.
698 (extra-version #f)
699 (configuration-file #f)
700 (defconfig "defconfig")
701 (extra-options %default-extra-linux-options)
702 (patches (list %boot-logo-patch)))
703 (make-linux-libre* version
704 (origin
705 (method url-fetch)
706 (uri (linux-libre-urls version))
707 (sha256 (base32 hash-string))
708 (patches patches))
709 supported-systems
710 #:extra-version extra-version
711 #:configuration-file configuration-file
712 #:defconfig defconfig
713 #:extra-options extra-options))
714
715 (define* (make-linux-libre* version source supported-systems
716 #:key
717 ;; A function that takes an arch and a variant.
718 ;; See kernel-config for an example.
719 (extra-version #f)
720 (configuration-file #f)
721 (defconfig "defconfig")
722 (extra-options %default-extra-linux-options))
723 (package
724 (name (if extra-version
725 (string-append "linux-libre-" extra-version)
726 "linux-libre"))
727 (version version)
728 (source source)
729 (supported-systems supported-systems)
730 (build-system gnu-build-system)
731 (native-inputs
732 `(("perl" ,perl)
733 ("bc" ,bc)
734 ("openssl" ,openssl)
735 ("elfutils" ,elfutils) ; Needed to enable CONFIG_STACK_VALIDATION
736 ("flex" ,flex)
737 ("bison" ,bison)
738
739 ;; These are needed to compile the GCC plugins.
740 ("gmp" ,gmp)
741 ("mpfr" ,mpfr)
742 ("mpc" ,mpc)
743
744 ,@(match (and configuration-file
745 (configuration-file
746 (system->linux-architecture
747 (or (%current-target-system) (%current-system)))
748 #:variant (version-major+minor version)))
749 (#f ;no config for this platform
750 '())
751 ((? string? config)
752 `(("kconfig" ,config))))))
753 (arguments
754 `(#:modules ((guix build gnu-build-system)
755 (guix build utils)
756 (srfi srfi-1)
757 (srfi srfi-26)
758 (ice-9 ftw)
759 (ice-9 match))
760 #:phases
761 (modify-phases %standard-phases
762 (add-after 'unpack 'patch-/bin/pwd
763 (lambda _
764 (substitute* (find-files "." "^Makefile(\\.include)?$")
765 (("/bin/pwd") "pwd"))
766 #t))
767 (replace 'configure
768 (lambda* (#:key inputs native-inputs target #:allow-other-keys)
769 ;; Avoid introducing timestamps
770 (setenv "KCONFIG_NOTIMESTAMP" "1")
771 (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
772
773 ;; Set ARCH and CROSS_COMPILE
774 (let ((arch ,(system->linux-architecture
775 (or (%current-target-system)
776 (%current-system)))))
777 (setenv "ARCH" arch)
778 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
779
780 (when target
781 (setenv "CROSS_COMPILE" (string-append target "-"))
782 (format #t "`CROSS_COMPILE' set to `~a'~%"
783 (getenv "CROSS_COMPILE"))))
784
785 (setenv "EXTRA_VERSION" ,extra-version)
786
787 (let ((build (assoc-ref %standard-phases 'build))
788 (config (assoc-ref (or native-inputs inputs) "kconfig")))
789
790 ;; Use a custom kernel configuration file or a default
791 ;; configuration file.
792 (if config
793 (begin
794 (copy-file config ".config")
795 (chmod ".config" #o666))
796 (invoke "make" ,defconfig))
797
798 ;; Appending works even when the option wasn't in the
799 ;; file. The last one prevails if duplicated.
800 (let ((port (open-file ".config" "a"))
801 (extra-configuration ,(config->string extra-options)))
802 (display extra-configuration port)
803 (close-port port))
804
805 (invoke "make" "oldconfig"))))
806 (replace 'install
807 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
808 (let* ((out (assoc-ref outputs "out"))
809 (moddir (string-append out "/lib/modules"))
810 (dtbdir (string-append out "/lib/dtbs")))
811 ;; Install kernel image, kernel configuration and link map.
812 (for-each (lambda (file) (install-file file out))
813 (find-files "." "^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
814 ;; Install device tree files
815 (unless (null? (find-files "." "\\.dtb$"))
816 (mkdir-p dtbdir)
817 (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
818 "dtbs_install"))
819 ;; Install kernel modules
820 (mkdir-p moddir)
821 (invoke "make"
822 ;; Disable depmod because the Guix system's module directory
823 ;; is an union of potentially multiple packages. It is not
824 ;; possible to use depmod to usefully calculate a dependency
825 ;; graph while building only one of those packages.
826 "DEPMOD=true"
827 (string-append "MODULE_DIR=" moddir)
828 (string-append "INSTALL_PATH=" out)
829 (string-append "INSTALL_MOD_PATH=" out)
830 "INSTALL_MOD_STRIP=1"
831 "modules_install")
832 (let* ((versions (filter (lambda (name)
833 (not (string-prefix? "." name)))
834 (scandir moddir)))
835 (version (match versions
836 ((x) x))))
837 ;; There are symlinks to the build and source directory,
838 ;; both of which will point to target /tmp/guix-build*
839 ;; and thus not be useful in a profile. Delete the symlinks.
840 (false-if-file-not-found
841 (delete-file (string-append moddir "/" version "/build")))
842 (false-if-file-not-found
843 (delete-file (string-append moddir "/" version "/source"))))
844 #t))))
845 #:tests? #f))
846 (home-page "https://www.gnu.org/software/linux-libre/")
847 (synopsis "100% free redistribution of a cleaned Linux kernel")
848 (description
849 "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
850 It has been modified to remove all non-free binary blobs.")
851 (license license:gpl2)))
852
853 \f
854 ;;;
855 ;;; Generic kernel packages.
856 ;;;
857
858 (define-public linux-libre-5.8
859 (make-linux-libre* linux-libre-5.8-version
860 linux-libre-5.8-source
861 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
862 #:configuration-file kernel-config))
863
864 (define-public linux-libre-version linux-libre-5.8-version)
865 (define-public linux-libre-pristine-source linux-libre-5.8-pristine-source)
866 (define-public linux-libre-source linux-libre-5.8-source)
867 (define-public linux-libre linux-libre-5.8)
868
869 (define-public linux-libre-5.4
870 (make-linux-libre* linux-libre-5.4-version
871 linux-libre-5.4-source
872 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
873 #:configuration-file kernel-config))
874
875 (define-public linux-libre-4.19
876 (make-linux-libre* linux-libre-4.19-version
877 linux-libre-4.19-source
878 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux")
879 #:configuration-file kernel-config))
880
881 (define-public linux-libre-4.14
882 (make-linux-libre* linux-libre-4.14-version
883 linux-libre-4.14-source
884 '("x86_64-linux" "i686-linux" "armhf-linux")
885 #:configuration-file kernel-config))
886
887 (define-public linux-libre-4.9
888 (make-linux-libre* linux-libre-4.9-version
889 linux-libre-4.9-source
890 '("x86_64-linux" "i686-linux")
891 #:configuration-file kernel-config))
892
893 (define-public linux-libre-4.4
894 (make-linux-libre* linux-libre-4.4-version
895 linux-libre-4.4-source
896 '("x86_64-linux" "i686-linux")
897 #:configuration-file kernel-config
898 #:extra-options
899 (append
900 `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
901 ;; This option was removed upstream in version 4.7.
902 ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #t))
903 %default-extra-linux-options)))
904
905 \f
906 ;;;
907 ;;; Specialized kernel variants.
908 ;;;
909
910 (define-public linux-libre-arm-generic
911 (make-linux-libre* linux-libre-version
912 linux-libre-source
913 '("armhf-linux")
914 #:defconfig "multi_v7_defconfig"
915 #:extra-version "arm-generic"
916 #:extra-options
917 (append
918 `(;; needed to fix the RTC on rockchip platforms
919 ("CONFIG_RTC_DRV_RK808" . #t))
920 %default-extra-linux-options)))
921
922 (define-public linux-libre-arm-veyron
923 (deprecated-package "linux-libre-arm-veyron" linux-libre-arm-generic))
924
925 (define-public linux-libre-arm-generic-5.4
926 (make-linux-libre* linux-libre-5.4-version
927 linux-libre-5.4-source
928 '("armhf-linux")
929 #:defconfig "multi_v7_defconfig"
930 #:extra-version "arm-generic"
931 #:extra-options
932 (append
933 `(;; needed to fix the RTC on rockchip platforms
934 ("CONFIG_RTC_DRV_RK808" . #t))
935 %default-extra-linux-options)))
936
937 (define-public linux-libre-arm-generic-4.19
938 (make-linux-libre* linux-libre-4.19-version
939 linux-libre-4.19-source
940 '("armhf-linux")
941 #:defconfig "multi_v7_defconfig"
942 #:extra-version "arm-generic"))
943
944 (define-public linux-libre-arm-generic-4.14
945 (make-linux-libre* linux-libre-4.14-version
946 linux-libre-4.14-source
947 '("armhf-linux")
948 #:defconfig "multi_v7_defconfig"
949 #:extra-version "arm-generic"))
950
951 (define-public linux-libre-arm-omap2plus
952 (make-linux-libre* linux-libre-version
953 linux-libre-source
954 '("armhf-linux")
955 #:defconfig "omap2plus_defconfig"
956 #:extra-version "arm-omap2plus"))
957
958 (define-public linux-libre-arm-omap2plus-4.19
959 (make-linux-libre* linux-libre-4.19-version
960 linux-libre-4.19-source
961 '("armhf-linux")
962 #:defconfig "omap2plus_defconfig"
963 #:extra-version "arm-omap2plus"))
964
965 (define-public linux-libre-arm-omap2plus-4.14
966 (make-linux-libre* linux-libre-4.14-version
967 linux-libre-4.14-source
968 '("armhf-linux")
969 #:defconfig "omap2plus_defconfig"
970 #:extra-version "arm-omap2plus"))
971
972 (define-public linux-libre-arm64-generic
973 (make-linux-libre* linux-libre-version
974 linux-libre-source
975 '("aarch64-linux")
976 #:defconfig "defconfig"
977 #:extra-version "arm64-generic"
978 #:extra-options
979 (append
980 `(;; needed to fix the RTC on rockchip platforms
981 ("CONFIG_RTC_DRV_RK808" . #t))
982 %default-extra-linux-options)))
983
984 (define-public linux-libre-arm64-generic-5.4
985 (make-linux-libre* linux-libre-5.4-version
986 linux-libre-5.4-source
987 '("aarch64-linux")
988 #:defconfig "defconfig"
989 #:extra-version "arm64-generic"
990 #:extra-options
991 (append
992 `(;; needed to fix the RTC on rockchip platforms
993 ("CONFIG_RTC_DRV_RK808" . #t))
994 %default-extra-linux-options)))
995
996 (define-public linux-libre-riscv64-generic
997 (make-linux-libre* linux-libre-version
998 linux-libre-source
999 '("riscv64-linux")
1000 #:extra-version "riscv64-generic"))
1001
1002 (define-public linux-libre-with-bpf
1003 (let ((base-linux-libre
1004 (make-linux-libre*
1005 linux-libre-5.4-version
1006 linux-libre-5.4-source
1007 '("x86_64-linux" "i686-linux" "armhf-linux"
1008 "aarch64-linux" "riscv64-linux")
1009 #:extra-version "bpf"
1010 #:configuration-file kernel-config
1011 #:extra-options
1012 (append %bpf-extra-linux-options
1013 %default-extra-linux-options))))
1014 (package
1015 (inherit base-linux-libre)
1016 (inputs `(("cpio" ,cpio) ,@(package-inputs base-linux-libre))))))
1017
1018
1019 \f
1020 ;;;
1021 ;;; Linux kernel modules.
1022 ;;;
1023
1024 (define-public acpi-call-linux-module
1025 (let ((commit "70b9c80bd700e6a4d10797eaac9fd34b7e8cbd4a")
1026 (revision "0"))
1027 (package
1028 (name "acpi-call-linux-module")
1029 (version (git-version "3.17" revision commit))
1030 (source
1031 (origin
1032 (method git-fetch)
1033 (uri (git-reference
1034 (url "https://github.com/teleshoes/acpi_call")
1035 (commit commit)))
1036 (file-name (git-file-name name version))
1037 (sha256
1038 (base32 "09c1vw6vcrkqxbwhpgfgpj4d1grzn4qq6ka8pwwzm7cvm405xj7x"))))
1039 (build-system linux-module-build-system)
1040 (arguments
1041 `(#:tests? #f ; no tests
1042 #:phases
1043 (modify-phases %standard-phases
1044 (add-after 'install 'install-documentation
1045 (lambda* (#:key outputs #:allow-other-keys)
1046 (let* ((out (assoc-ref outputs "out"))
1047 (doc (string-append out "/share/doc/" ,name "-" ,version)))
1048 (for-each (lambda (file)
1049 (let ((target (string-append doc "/" file)))
1050 (mkdir-p (dirname target))
1051 (copy-recursively file target)))
1052 (list "README.md" "examples"))
1053 #t))))))
1054 (home-page "https://github.com/teleshoes/acpi_call")
1055 (synopsis "Linux kernel module to perform ACPI method calls")
1056 (description
1057 "This simple Linux kernel module allows calls from user space to any
1058 @acronym{ACPI, Advanced Configuration and Power Interface} method provided by
1059 your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass
1060 any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING},
1061 and @code{ACPI_BUFFER}.
1062
1063 It grants direct and undocumented access to your hardware that may cause damage
1064 and should be used with caution, especially on untested models.")
1065 (license license:gpl3+)))) ; see README.md (no licence headers)
1066
1067 (define-public rtl8812au-aircrack-ng-linux-module
1068 (let ((commit "df2b8dfd8cb7d9f6cfeb55abaeab8a5372011fc9")
1069 (revision "1"))
1070 (package
1071 (name "rtl8812au-aircrack-ng-linux-module")
1072 (version (git-version "5.6.4.2" revision commit))
1073 (source
1074 (origin
1075 (method git-fetch)
1076 (uri (git-reference
1077 (url "https://github.com/aircrack-ng/rtl8812au")
1078 (commit commit)))
1079 (file-name (git-file-name name version))
1080 (sha256
1081 (base32 "1qcr0j8yhg8l9l0f5y55zcsk1mgf3qd46yh9xfqgg91szxa3yvca"))
1082 (modules '((guix build utils)))
1083 (snippet
1084 '(begin
1085 ;; Remove bundled tarballs, APKs, word lists, speadsheets,
1086 ;; and other unnecessary unlicenced things.
1087 (for-each delete-file-recursively (list "android"
1088 "docs"
1089 "tools"))
1090 #t))))
1091 (build-system linux-module-build-system)
1092 (arguments
1093 `(#:make-flags
1094 (list (string-append "KSRC="
1095 (assoc-ref %build-inputs "linux-module-builder")
1096 "/lib/modules/build"))
1097 #:phases
1098 (modify-phases %standard-phases
1099 (replace 'build
1100 (lambda* (#:key (make-flags '()) #:allow-other-keys)
1101 (apply invoke "make" make-flags))))
1102 #:tests? #f)) ; no test suite
1103 (supported-systems '("x86_64-linux" "i686-linux"))
1104 (home-page "https://github.com/aircrack-ng/rtl8812au")
1105 (synopsis "Linux driver for Realtek USB wireless network adapters")
1106 (description
1107 "This is Realtek's rtl8812au Linux driver for USB 802.11n wireless
1108 network adapters, modified by the aircrack-ng project to support monitor mode
1109 and frame injection. It provides a @code{88XXau} kernel module that supports
1110 RTL8812AU, RTL8821AU, and RTL8814AU chips.")
1111 (license license:gpl2+))))
1112
1113 (define-public rtl8821ce-linux-module
1114 (let ((commit "69765eb288a8dfad3b055b906760b53e02ab1dea")
1115 (revision "0"))
1116 (package
1117 (name "rtl8821ce-linux-module")
1118 (version (git-version "0.0.0" revision commit))
1119 (source
1120 (origin
1121 (method git-fetch)
1122 (uri (git-reference
1123 (url "https://github.com/tomaspinho/rtl8821ce")
1124 (commit commit)))
1125 (file-name (git-file-name name version))
1126 (sha256
1127 (base32
1128 "17jiw25k74kv5lnvgycvj2g1n06hbrpjz6p4znk4a62g136rhn4s"))))
1129 (build-system linux-module-build-system)
1130 (arguments
1131 `(#:make-flags
1132 (list "CC=gcc"
1133 (string-append "KSRC="
1134 (assoc-ref %build-inputs "linux-module-builder")
1135 "/lib/modules/build"))
1136 #:phases
1137 (modify-phases %standard-phases
1138 (replace 'build
1139 (lambda* (#:key (make-flags '()) #:allow-other-keys)
1140 (apply invoke "make" make-flags))))
1141 #:tests? #f)) ; no test suite
1142 (home-page "https://github.com/tomaspinho/rtl8821ce")
1143 (synopsis "Linux driver for Realtek RTL8821CE wireless network adapters")
1144 (description "This is Realtek's RTL8821CE Linux driver for wireless
1145 network adapters.")
1146 (license license:gpl2))))
1147
1148 (define-public vhba-module
1149 (package
1150 (name "vhba-module")
1151 (version "20200106")
1152 (source (origin
1153 (method url-fetch)
1154 (uri (string-append
1155 "http://downloads.sourceforge.net/cdemu/vhba-module/vhba-module-"
1156 version ".tar.bz2"))
1157 (sha256
1158 (base32
1159 "10rlvsfj0fw6n0qmwcnvhimqnsnhi7n55lyl7fq1pkwggf5218sr"))))
1160 (build-system linux-module-build-system)
1161 (arguments
1162 ;; TODO: No tests?
1163 `(#:tests? #f))
1164 (home-page "https://cdemu.sourceforge.io/")
1165 (synopsis "Kernel module that emulates SCSI devices")
1166 (description "VHBA module provides a Virtual (SCSI) HBA, which is the link
1167 between the CDemu userspace daemon and linux kernel.")
1168 (license license:gpl2+)))
1169
1170 (define-public bbswitch-module
1171 (package
1172 (name "bbswitch-module")
1173 (version "0.8")
1174 (source (origin
1175 (method git-fetch)
1176 (uri (git-reference
1177 (url "https://github.com/Bumblebee-Project/bbswitch")
1178 (commit (string-append "v" version))))
1179 (file-name (git-file-name name version))
1180 (sha256
1181 (base32
1182 "1glch4j0x1dzlp2yrb67v2r5jg9609jb6p8m251y78m74advqw0l"))))
1183 (build-system linux-module-build-system)
1184 (arguments
1185 ;; No tests.
1186 `(#:tests? #f))
1187 (home-page "https://github.com/Bumblebee-Project/bbswitch")
1188 (synopsis "Kernel module that disables discrete Nvidia graphics cards")
1189 (description "The bbswitch module provides a way to toggle the Nvidia
1190 graphics card on Optimus laptops.")
1191 (license license:gpl2)))
1192
1193 (define-public ddcci-driver-linux
1194 (package
1195 (name "ddcci-driver-linux")
1196 (version "0.3.3")
1197 (source
1198 (origin
1199 (method git-fetch)
1200 (uri
1201 (git-reference
1202 (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
1203 (commit (string-append "v" version))))
1204 (file-name (git-file-name name version))
1205 (sha256
1206 (base32
1207 "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
1208 (build-system linux-module-build-system)
1209 (arguments
1210 `(#:tests? #f ; no tests
1211 #:phases
1212 (modify-phases %standard-phases
1213 (replace 'build
1214 (lambda args
1215 (for-each
1216 (lambda (module)
1217 (with-directory-excursion module
1218 (apply (assoc-ref %standard-phases 'build) args)))
1219 '("ddcci" "ddcci-backlight"))
1220 #t))
1221 (replace 'install
1222 (lambda args
1223 (for-each
1224 (lambda (module)
1225 (with-directory-excursion module
1226 (apply (assoc-ref %standard-phases 'install) args)))
1227 '("ddcci" "ddcci-backlight"))
1228 #t)))))
1229 (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
1230 (synopsis "Pair of Linux kernel drivers for DDC/CI monitors")
1231 (description "This package provides two Linux kernel drivers, ddcci and
1232 ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs
1233 interface. The ddcci module creates a character device for each DDC/CI
1234 monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight
1235 module allows the control of the backlight level or luminance property when
1236 supported under @file{/sys/class/backlight/}.")
1237 (license license:gpl2+)))
1238
1239 (define-public v4l2loopback-linux-module
1240 (package
1241 (name "v4l2loopback-linux-module")
1242 (version "0.12.5")
1243 (source (origin
1244 (method git-fetch)
1245 (uri (git-reference
1246 (url "https://github.com/umlaeute/v4l2loopback")
1247 (commit (string-append "v" version))))
1248 (file-name (git-file-name name version))
1249 (sha256
1250 (base32
1251 "1qi4l6yam8nrlmc3zwkrz9vph0xsj1cgmkqci4652mbpbzigg7vn"))))
1252 (build-system linux-module-build-system)
1253 (arguments
1254 `(#:tests? #f)) ; no test suite
1255 (home-page "https://github.com/umlaeute/v4l2loopback")
1256 (synopsis "Linux kernel module to create virtual V4L2 video devices")
1257 (description
1258 "This Linux module creates virtual video devices. @acronym{V4L2, Video
1259 for Linux 2} applications will treat these as ordinary video devices but read
1260 video data generated by another application, instead of a hardware device such
1261 as a capture card.
1262
1263 This lets you apply nifty effects to your Jitsi video, for example, but also
1264 allows some more serious things like adding streaming capabilities to an
1265 application by hooking GStreamer into the loopback device.")
1266 (license license:gpl2+)))
1267
1268 \f
1269 ;;;
1270 ;;; Pluggable authentication modules (PAM).
1271 ;;;
1272
1273 (define-public linux-pam
1274 (package
1275 (name "linux-pam")
1276 (version "1.3.1")
1277 (source
1278 (origin
1279 (method url-fetch)
1280 (uri (string-append
1281 "https://github.com/linux-pam/linux-pam/releases/download/v"
1282 version "/Linux-PAM-" version ".tar.xz"))
1283 (sha256
1284 (base32
1285 "1nyh9kdi3knhxcbv5v4snya0g3gff0m671lnvqcbygw3rm77mx7g"))
1286 (patches (search-patches "linux-pam-no-setfsuid.patch"))))
1287
1288 (build-system gnu-build-system)
1289 (native-inputs
1290 `(("flex" ,flex)
1291
1292 ;; TODO: optional dependencies
1293 ;; ("libxcrypt" ,libxcrypt)
1294 ;; ("cracklib" ,cracklib)
1295 ))
1296 (arguments
1297 `(;; Most users, such as `shadow', expect the headers to be under
1298 ;; `security'.
1299 #:configure-flags (list (string-append "--includedir="
1300 (assoc-ref %outputs "out")
1301 "/include/security")
1302
1303 ;; XXX: <rpc/rpc.h> is missing from glibc when
1304 ;; cross-compiling, so we have to disable NIS
1305 ;; support altogether.
1306 ,@(if (%current-target-system)
1307 '("--disable-nis")
1308 '()))
1309
1310 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
1311 ;; isn't available.
1312 #:tests? #f))
1313 (home-page "http://www.linux-pam.org/")
1314 (synopsis "Pluggable authentication modules for Linux")
1315 (description
1316 "A *Free* project to implement OSF's RFC 86.0.
1317 Pluggable authentication modules are small shared object files that can
1318 be used through the PAM API to perform tasks, like authenticating a user
1319 at login. Local and dynamic reconfiguration are its key features.")
1320 (license license:bsd-3)))
1321
1322 (define-public linux-pam-1.2
1323 (package
1324 (inherit linux-pam)
1325 (version "1.2.1")
1326 (source
1327 (origin
1328 (method url-fetch)
1329 (uri (string-append
1330 "http://www.linux-pam.org/library/"
1331 "Linux-PAM-" version ".tar.bz2"))
1332 (sha256
1333 (base32
1334 "1n9lnf9gjs72kbj1g354v1xhi2j27aqaah15vykh7cnkq08i4arl"))
1335 (patches (search-patches "linux-pam-no-setfsuid.patch"))))))
1336
1337 (define-public python-pamela
1338 (package
1339 (name "python-pamela")
1340 (version "1.0.0")
1341 (source
1342 (origin
1343 ;; Tests not distributed in pypi release.
1344 (method git-fetch)
1345 (uri (git-reference
1346 (url "https://github.com/minrk/pamela.git")
1347 (commit version)))
1348 (file-name (git-file-name name version))
1349 (sha256
1350 (base32
1351 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr"))))
1352 (build-system python-build-system)
1353 (arguments
1354 '(#:tests? #f ; Test suite isn't designed to be run inside a container.
1355 #:phases
1356 (modify-phases %standard-phases
1357 (add-after 'unpack 'hardcode-pam.so
1358 (lambda* (#:key inputs #:allow-other-keys)
1359 (let ((pam (assoc-ref inputs "linux-pam")))
1360 (substitute* "pamela.py"
1361 (("find_library\\(\"pam\")")
1362 (string-append "'" pam "/lib/libpam.so'")))
1363 #t)))
1364 (replace 'check
1365 (lambda* (#:key tests? #:allow-other-keys)
1366 (if tests?
1367 (if (file-exists? "test_pamela.py")
1368 (invoke "py.test" "--assert=plain" "test_pamela.py")
1369 (invoke "python" "-m" "pamela" "-a" "`whoami`"))
1370 #t))))))
1371 (inputs
1372 `(("linux-pam" ,linux-pam)))
1373 (native-inputs
1374 `(("python-pytest" ,python-pytest)))
1375 (home-page "https://github.com/minrk/pamela")
1376 (synopsis "PAM interface using ctypes")
1377 (description "This package provides a PAM interface using @code{ctypes}.")
1378 (license license:expat)))
1379
1380
1381 ;;;
1382 ;;; Miscellaneous.
1383 ;;;
1384
1385 (define-public powerstat
1386 (package
1387 (name "powerstat")
1388 (version "0.02.22")
1389 (source
1390 (origin
1391 (method url-fetch)
1392 (uri (string-append "https://kernel.ubuntu.com/~cking/tarballs/"
1393 "powerstat/powerstat-" version ".tar.gz"))
1394 (sha256
1395 (base32 "0r355b9syqa2nhfy8ksvxyy5d58v0isf983842js091s6liy0x7g"))))
1396 (build-system gnu-build-system)
1397 (arguments
1398 `(#:make-flags
1399 (list (string-append "CC=" ,(cc-for-target))
1400 (string-append "prefix=" (assoc-ref %outputs "out")))
1401 #:tests? #f ; no test suite
1402 #:phases
1403 (modify-phases %standard-phases
1404 (add-after 'unpack 'respect-$prefix
1405 ;; https://bugs.launchpad.net/ubuntu/+source/powerstat/+bug/1877744
1406 (lambda _
1407 (substitute* "Makefile"
1408 (("DIR=/usr/") "DIR=$(prefix)/"))
1409 #t))
1410 (delete 'configure)))) ; no configure script
1411 (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
1412 (synopsis "Measure system power consumption")
1413 (description
1414 "Powerstat measures and reports your computer's power consumption in real
1415 time. On mobile PCs, it uses ACPI battery information to measure the power
1416 drain of the entire system.
1417
1418 Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
1419 domain measurements. These are available only on some hardware such as Intel
1420 Sandybridge and newer, and cover only part of the machine's components such as
1421 CPU, DRAM, and graphics. However, they provide accurate and immediate readings
1422 and don't require a battery at all.
1423
1424 The output is like @command{vmstat} but also shows power consumption statistics:
1425 at the end of a run, @command{powerstat} will calculate the average, standard
1426 deviation, and minimum and maximum values. It can show a nice histogram too.")
1427 (license license:gpl2)))
1428
1429 (define-public psmisc
1430 (package
1431 (name "psmisc")
1432 (version "23.3")
1433 (source
1434 (origin
1435 (method url-fetch)
1436 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
1437 version ".tar.xz"))
1438 (sha256
1439 (base32 "16i7qzjmm6g0lzha8yzpfrlcxnvkgh95hkq9gdjd4zmzb8d0wxa1"))))
1440 (build-system gnu-build-system)
1441 (arguments
1442 `(,@(if (%current-target-system)
1443 '(#:configure-flags
1444 (list
1445 "ac_cv_func_malloc_0_nonnull=yes"
1446 "ac_cv_func_realloc_0_nonnull=yes"))
1447 '())))
1448 (inputs `(("ncurses" ,ncurses)))
1449 (home-page "https://gitlab.com/psmisc/psmisc")
1450 (synopsis "Small utilities that use the proc file system")
1451 (description
1452 "This PSmisc package is a set of some small useful utilities that
1453 use the proc file system. We're not about changing the world, but
1454 providing the system administrator with some help in common tasks.")
1455 (license license:gpl2+)))
1456
1457 (define-public util-linux
1458 (package
1459 (name "util-linux")
1460 (version "2.35.1")
1461 (source (origin
1462 (method url-fetch)
1463 (uri (string-append "mirror://kernel.org/linux/utils/"
1464 "util-linux/v" (version-major+minor version) "/"
1465 "util-linux-" version ".tar.xz"))
1466 (sha256
1467 (base32
1468 "1yfpy6bkab4jw61mpx48gfy24yrqp4a7arvpis8csrkk53fkxpnr"))
1469 (patches (search-patches "util-linux-tests.patch"))
1470 (modules '((guix build utils)))
1471 (snippet
1472 ;; We take 'nologin' from Shadow, the 'logger' program from
1473 ;; GNU Inetutils and 'kill' from GNU Coreutils.
1474 '(begin
1475 (substitute* "configure"
1476 (("build_nologin=yes") "build_nologin=no")
1477 (("build_logger=yes") "build_logger=no")
1478 (("build_kill=yes") "build_kill=no"))
1479 #t))))
1480 (build-system gnu-build-system)
1481 (outputs '("out" ;6.4 MiB executables and documentation
1482 "lib" ;8.8 MiB shared libraries, headers and locales
1483 "static")) ;2.9 MiB static .a libraries
1484 (arguments
1485 `(#:configure-flags (list "--disable-use-tty-group"
1486 "--enable-fs-paths-default=/run/current-system/profile/sbin"
1487 ;; Don't try to chown root:root mount and umount
1488 "--disable-makeinstall-chown"
1489 "--localstatedir=/var"
1490 (string-append "--localedir="
1491 (assoc-ref %outputs "lib")
1492 "/share/locale")
1493 ;; Install completions where our
1494 ;; bash-completion package expects them.
1495 (string-append "--with-bashcompletiondir="
1496 (assoc-ref %outputs "out")
1497 "/etc/bash_completion.d"))
1498 #:phases (modify-phases %standard-phases
1499 (add-before 'configure 'patch-build-scripts
1500 (lambda* (#:key outputs #:allow-other-keys)
1501 (substitute* "configure"
1502 ;; The build system assumes that we want to install
1503 ;; libraries below $exec_prefix when $libdir does not
1504 ;; match any of the "usual" locations. Fix that.
1505 (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir")
1506 "usrlib_execdir=$libdir"))
1507 #t))
1508 (add-before 'build 'set-umount-file-name
1509 (lambda* (#:key outputs #:allow-other-keys)
1510 ;; Tell 'eject' the right file name of 'umount'.
1511 (let ((out (assoc-ref outputs "out")))
1512 (substitute* "sys-utils/eject.c"
1513 (("\"/bin/umount\"")
1514 (string-append "\"" out "/bin/umount\"")))
1515 #t)))
1516 (add-before 'check 'pre-check
1517 (lambda* (#:key inputs outputs #:allow-other-keys)
1518 (let ((out (assoc-ref outputs "out"))
1519 (net (assoc-ref inputs "net-base")))
1520 ;; Change the test to refer to the right file.
1521 (substitute* "tests/ts/misc/mcookie"
1522 (("/etc/services")
1523 (string-append net "/etc/services")))
1524
1525 ;; The C.UTF-8 locale does not exist in our libc.
1526 (substitute* "tests/ts/column/invalid-multibyte"
1527 (("C\\.UTF-8") "en_US.utf8"))
1528 #t)))
1529 ;; TODO: Remove the conditional on the next rebuild cycle.
1530 ,@(if (string-prefix? "arm" (%current-system))
1531 '((add-before 'check 'disable-setarch-test
1532 (lambda _
1533 ;; The setarch tests are unreliable in QEMU's
1534 ;; user-mode emulation, which is our primary
1535 ;; method of building ARMv7 packages.
1536 ;; <https://github.com/karelzak/util-linux/issues/601>
1537 (substitute* "tests/ts/misc/setarch"
1538 (("ts_init_subtest.*" all)
1539 (string-append
1540 all "\n"
1541 "ts_skip \"setarch tests are unreliable under QEMU\"")))
1542 #t)))
1543 '())
1544 (add-after 'install 'move-static-libraries
1545 (lambda* (#:key outputs #:allow-other-keys)
1546 (let ((lib (assoc-ref outputs "lib"))
1547 (static (assoc-ref outputs "static")))
1548
1549 ;; Move static libraries to the "static" output.
1550 (mkdir-p (string-append static "/lib"))
1551 (with-directory-excursion lib
1552 (for-each (lambda (file)
1553 (rename-file file
1554 (string-append static "/"
1555 file)))
1556 (find-files "lib" "\\.a$"))
1557
1558 ;; Remove references to the static library from the '.la'
1559 ;; files so that Libtool does the right thing when both
1560 ;; the shared and static library is available.
1561 (substitute* (find-files "lib" "\\.la$")
1562 (("old_library=.*") "old_library=''\n")))
1563
1564 #t)))
1565 (add-after 'install 'adjust-pkg-config-files
1566 (lambda* (#:key outputs #:allow-other-keys)
1567 (let ((lib (assoc-ref outputs "lib")))
1568 ;; Drop the unused "prefix=" and "exec_prefix=" variables from
1569 ;; the pkg-config files to avoid a cyclic reference on "out".
1570 (substitute* (find-files (string-append lib "/lib/pkgconfig")
1571 "\\.pc$")
1572 (("^(exec_)?prefix=.*") "")))
1573 #t)))))
1574 (inputs `(("zlib" ,zlib)
1575 ("ncurses" ,ncurses)
1576
1577 ;; XXX: This is so that the 'pre-check' phase can find it.
1578 ,@(if (%current-target-system)
1579 `(("net-base" ,net-base))
1580 '())))
1581 (native-inputs
1582 `(("perl" ,perl)
1583 ("net-base" ,net-base))) ;for tests
1584 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
1585 (synopsis "Collection of utilities for the Linux kernel")
1586 (description "Util-linux is a diverse collection of Linux kernel
1587 utilities. It provides dmesg and includes tools for working with file systems,
1588 block devices, UUIDs, TTYs, and many other tools.")
1589
1590 ;; Note that util-linux doesn't use the same license for all the
1591 ;; code. GPLv2+ is the default license for a code without an
1592 ;; explicitly defined license.
1593 (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
1594 license:bsd-4 license:public-domain))))
1595
1596 ;; util-linux optionally supports udev, which allows lsblk to read file system
1597 ;; metadata without special privileges. Add it as a separate package to avoid
1598 ;; a circular dependency, and to keep the size small.
1599 (define-public util-linux+udev
1600 (package/inherit
1601 util-linux
1602 (name "util-linux-with-udev")
1603 (inputs
1604 `(("udev" ,eudev)
1605 ,@(package-inputs util-linux)))))
1606
1607 (define-public ddate
1608 (package
1609 (name "ddate")
1610 (version "0.2.2")
1611 (source (origin
1612 (method git-fetch)
1613 (uri (git-reference
1614 (url "https://github.com/bo0ts/ddate")
1615 (commit (string-append "v" version))))
1616 (file-name (git-file-name name version))
1617 (sha256
1618 (base32 "1qchxnxvghbma6gp1g78wnjxsri0b72ha9axyk31cplssl7yn73f"))))
1619 (build-system cmake-build-system)
1620 (arguments '(#:tests? #f))
1621 (home-page "https://github.com/bo0ts/ddate")
1622 (synopsis "PERPETUAL DATE CONVERTER FROM GREGORIAN TO POEE CALENDAR")
1623 (description
1624 "ddate displays the Discordian date and holidays of a given date.
1625 The Discordian calendar was made popular by the \"Illuminatus!\" trilogy
1626 by Robert Shea and Robert Anton Wilson.")
1627 (license license:public-domain)))
1628
1629 (define-public fbset
1630 (package
1631 (name "fbset")
1632 (version "2.1")
1633 (source
1634 (origin
1635 (method url-fetch)
1636 (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-"
1637 version ".tar.gz"))
1638 (sha256
1639 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0"))))
1640 (build-system gnu-build-system)
1641 (arguments
1642 '(#:modules ((guix build gnu-build-system)
1643 (guix build utils)
1644 (srfi srfi-26))
1645 #:phases
1646 (modify-phases %standard-phases
1647 (delete 'configure) ; no configure script
1648 (add-before 'install 'pre-install
1649 (lambda* (#:key outputs #:allow-other-keys)
1650 (let ((out (assoc-ref outputs "out")))
1651 (substitute* "Makefile"
1652 (("mknod ") "true ")
1653 ;; The Makefile doesn't honour PREFIX or similar.
1654 (("/usr") out))
1655 (mkdir out)
1656 (with-directory-excursion out
1657 (for-each mkdir-p (list "sbin"
1658 "man/man5"
1659 "man/man8")))
1660 #t)))
1661 (add-after 'install 'install-fb.modes
1662 (lambda* (#:key outputs #:allow-other-keys)
1663 (let* ((out (assoc-ref outputs "out"))
1664 (etc (string-append out "/etc")))
1665 (for-each (cut install-file <> etc)
1666 (find-files "etc" "^fb\\.modes"))
1667 (symlink "fb.modes.ATI"
1668 (string-append etc "/fb.modes"))
1669 #t))))
1670 ;; Parallel building races to create modes.tab.c.
1671 #:parallel-build? #f
1672 #:tests? #f)) ; no test suite
1673 (native-inputs
1674 `(("bison" ,bison)
1675 ("flex" ,flex)))
1676 (home-page "http://users.telenet.be/geertu/Linux/fbdev/")
1677 (synopsis "Show and modify Linux frame buffer settings")
1678 (description
1679 "The kernel Linux's @dfn{frame buffers} provide a simple interface to
1680 different kinds of graphic displays. The @command{fbset} utility can query and
1681 change various device settings such as depth, virtual resolution, and timing
1682 parameters.")
1683 (license license:gpl2)))
1684
1685 (define-public procps
1686 (package
1687 (name "procps")
1688 (version "3.3.16")
1689 (source (origin
1690 (method url-fetch)
1691 (uri (string-append "mirror://sourceforge/procps-ng/Production/"
1692 "procps-ng-" version ".tar.xz"))
1693 (sha256
1694 (base32
1695 "1br0g93ysqhlv13i1k4lfbimsgxnpy5rgs4lxfc9rkzdbpbaqplj"))))
1696 (build-system gnu-build-system)
1697 (arguments
1698 `(#:modules ((guix build utils)
1699 (guix build gnu-build-system)
1700 (srfi srfi-1)
1701 (srfi srfi-26))
1702 ,@(if (%current-target-system)
1703 '(#:configure-flags
1704 (list
1705 "ac_cv_func_malloc_0_nonnull=yes"
1706 "ac_cv_func_realloc_0_nonnull=yes"))
1707 '())
1708 #:phases
1709 (modify-phases %standard-phases
1710 (add-after
1711 'install 'post-install
1712 ;; Remove commands and man pages redudant with
1713 ;; Coreutils.
1714 (lambda* (#:key outputs #:allow-other-keys)
1715 (let* ((out (assoc-ref outputs "out"))
1716 (dup (append-map (cut find-files out <>)
1717 '("^kill" "^uptime"))))
1718 (for-each delete-file dup)
1719 #t))))))
1720 (inputs `(("ncurses" ,ncurses)))
1721 (home-page "https://gitlab.com/procps-ng/procps/")
1722 (synopsis "Utilities that give information about processes")
1723 (description
1724 "Procps is the package that has a bunch of small useful utilities
1725 that give information about processes using the Linux /proc file system.
1726 The package includes the programs ps, top, vmstat, w, kill, free,
1727 slabtop, and skill.")
1728 (license license:gpl2)))
1729
1730 (define-public usbutils
1731 (package
1732 (name "usbutils")
1733 (version "012")
1734 (source
1735 (origin
1736 (method url-fetch)
1737 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
1738 "usbutils-" version ".tar.xz"))
1739 (sha256
1740 (base32 "0iiy0q7fzikavmdsjsb0sl9kp3gfh701qwyjjccvqh0qz4jlcqw8"))))
1741 (build-system gnu-build-system)
1742 (outputs (list "out" "python"))
1743 (arguments
1744 `(#:phases
1745 (modify-phases %standard-phases
1746 (add-before 'bootstrap 'patch-bootstrap-scripts
1747 (lambda _
1748 (substitute* "usbhid-dump/bootstrap"
1749 (("/bin/bash") (which "bash")))
1750
1751 ;; Don't let autogen.sh run configure with bogus options & CFLAGS.
1752 (substitute* "autogen.sh"
1753 (("^\\./configure.*") ""))
1754 #t))
1755 (add-after 'install 'separate-python-output
1756 ;; Separating one Python script shaves more than 106 MiB from :out.
1757 (lambda* (#:key outputs #:allow-other-keys)
1758 (let ((out (assoc-ref outputs "out"))
1759 (out:python (assoc-ref outputs "python")))
1760 (for-each (lambda (file)
1761 (let ((old (string-append out "/" file))
1762 (new (string-append out:python "/" file)))
1763 (mkdir-p (dirname new))
1764 (rename-file old new)))
1765 (list "bin/lsusb.py"))
1766 #t))))))
1767 (inputs
1768 `(("eudev" ,eudev)
1769 ("libusb" ,libusb)
1770 ("python" ,python)))
1771 (native-inputs
1772 `(("autoconf" ,autoconf)
1773 ("automake" ,automake)
1774 ("libtool" ,libtool)
1775 ("pkg-config" ,pkg-config)))
1776 (home-page "http://www.linux-usb.org/")
1777 (synopsis
1778 "Tools for working with USB devices, such as lsusb")
1779 (description
1780 "Tools for working with USB devices, such as lsusb.")
1781 (license license:gpl2+)))
1782
1783 (define-public e2fsprogs
1784 (package
1785 (name "e2fsprogs")
1786 (version "1.45.6")
1787 (source (origin
1788 (method url-fetch)
1789 (uri (string-append
1790 "mirror://kernel.org/linux/kernel/people/tytso/"
1791 "e2fsprogs/v" version "/"
1792 "e2fsprogs-" version ".tar.xz"))
1793 (sha256
1794 (base32
1795 "0mj2yizwygs7xww8jfy5mxjn8ww4pvc0b1hg1p2vsnirailsx9zz"))))
1796 (build-system gnu-build-system)
1797 (inputs `(("util-linux" ,util-linux "lib")))
1798 (native-inputs `(("pkg-config" ,pkg-config)
1799 ("texinfo" ,texinfo) ;for the libext2fs Info manual
1800
1801 ;; For tests.
1802 ("perl" ,perl)
1803 ("procps" ,procps)))
1804 (arguments
1805 '(;; util-linux is the preferred source for some of the libraries and
1806 ;; commands, so disable them (see, e.g.,
1807 ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
1808 #:configure-flags (list "--disable-libblkid"
1809 "--disable-libuuid" "--disable-uuidd"
1810 "--disable-fsck"
1811
1812 ;; Use symlinks instead of hard links for
1813 ;; 'fsck.extN' etc. This makes the resulting nar
1814 ;; smaller and is preserved across copies.
1815 "--enable-symlink-install"
1816
1817 (string-append "LDFLAGS=-Wl,-rpath="
1818 (assoc-ref %outputs "out")
1819 "/lib")
1820
1821 ;; Install libext2fs et al.
1822 "--enable-elf-shlibs")
1823
1824 #:phases
1825 (modify-phases %standard-phases
1826 (add-before 'configure 'patch-shells
1827 (lambda _
1828 (substitute* "configure"
1829 (("/bin/sh (.*)parse-types.sh" _ dir)
1830 (string-append (which "sh") " " dir
1831 "parse-types.sh")))
1832 (substitute* "MCONFIG.in"
1833 (("INSTALL_SYMLINK = /bin/sh")
1834 "INSTALL_SYMLINK = sh"))
1835 (substitute* (find-files "." "^Makefile.in$")
1836 (("#!/bin/sh")
1837 (string-append "#!" (which "sh"))))
1838 #t))
1839 (add-after 'install 'install-libs
1840 (lambda* (#:key outputs #:allow-other-keys)
1841 (let* ((out (assoc-ref outputs "out"))
1842 (lib (string-append out "/lib")))
1843 (invoke "make" "install-libs")
1844
1845 ;; Make the .a writable so that 'strip' works.
1846 ;; Failing to do that, due to debug symbols, we
1847 ;; retain a reference to the final
1848 ;; linux-libre-headers, which refer to the
1849 ;; bootstrap binaries.
1850 (let ((archives (find-files lib "\\.a$")))
1851 (for-each (lambda (file)
1852 (chmod file #o666))
1853 archives))
1854 #t))))))
1855 (home-page "http://e2fsprogs.sourceforge.net/")
1856 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
1857 (description
1858 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
1859 (license (list license:gpl2 ;programs
1860 license:lgpl2.0 ;libext2fs
1861 license:x11)))) ;libuuid
1862
1863 (define e2fsprogs/static
1864 (static-package
1865 (package (inherit e2fsprogs)
1866 (arguments
1867 ;; Do not build shared libraries.
1868 (substitute-keyword-arguments (package-arguments e2fsprogs)
1869 ((#:configure-flags _)
1870 '(list "--disable-blkid"))
1871 ((#:make-flags _)
1872 '(list)))))))
1873
1874 (define-public e2fsck/static
1875 (package
1876 (name "e2fsck-static")
1877 (version (package-version e2fsprogs))
1878 (build-system trivial-build-system)
1879 (source #f)
1880 (inputs
1881 `(("e2fsprogs" ,e2fsprogs/static)))
1882 (arguments
1883 `(#:modules ((guix build utils))
1884 #:builder
1885 (begin
1886 (use-modules (guix build utils)
1887 (ice-9 ftw)
1888 (srfi srfi-26))
1889
1890 (let ((e2fsck (string-append (assoc-ref %build-inputs "e2fsprogs")
1891 "/sbin/e2fsck"))
1892 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
1893 (mkdir-p bin)
1894 (with-directory-excursion bin
1895 (copy-file e2fsck "e2fsck")
1896 (remove-store-references "e2fsck")
1897 (chmod "e2fsck" #o555))
1898 #t))))
1899 (home-page (package-home-page e2fsprogs))
1900 (synopsis "Statically-linked e2fsck command from e2fsprogs")
1901 (description "This package provides statically-linked e2fsck command taken
1902 from the e2fsprogs package. It is meant to be used in initrds.")
1903 (license (package-license e2fsprogs))))
1904
1905 (define-public extundelete
1906 (package
1907 (name "extundelete")
1908 (version "0.2.4")
1909 (source
1910 (origin
1911 (method url-fetch)
1912 (uri (string-append "mirror://sourceforge/extundelete/"
1913 "extundelete/" version "/extundelete-"
1914 version ".tar.bz2"))
1915 (sha256
1916 (base32
1917 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))
1918 (patches (search-patches "extundelete-e2fsprogs-1.44.patch"))))
1919 (build-system gnu-build-system)
1920 (inputs `(("e2fsprogs" ,e2fsprogs)))
1921 (home-page "http://extundelete.sourceforge.net/")
1922 (synopsis "Recover deleted files from ext2/3/4 partitions")
1923 (description
1924 "Extundelete is a set of tools that can recover deleted files from an
1925 ext3 or ext4 partition.")
1926 (license license:gpl2)))
1927
1928 (define-public zerofree
1929 (package
1930 (name "zerofree")
1931 (version "1.1.1")
1932 (home-page "https://frippery.org/uml/")
1933 (source (origin
1934 (method url-fetch)
1935 (uri (string-append home-page name "-" version
1936 ".tgz"))
1937 (sha256
1938 (base32
1939 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm"))))
1940 (build-system gnu-build-system)
1941 (arguments
1942 '(#:phases
1943 (modify-phases %standard-phases
1944 (delete 'configure) ; no configure script
1945 (replace 'install
1946 ;; The Makefile lacks an ‘install’ target.
1947 (lambda* (#:key outputs #:allow-other-keys)
1948 (let* ((out (assoc-ref outputs "out"))
1949 (bin (string-append out "/bin")))
1950 (chmod "zerofree" #o555)
1951 (install-file "zerofree" bin)
1952 #t))))
1953 #:tests? #f)) ; no tests
1954 (inputs `(("libext2fs" ,e2fsprogs)))
1955 (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
1956 (description
1957 "Zerofree finds the unallocated blocks with non-zero value content in an
1958 ext2, ext3, or ext4 file system and fills them with zeroes (or another value).
1959 This is a simple way to make disk images more compressible.
1960 Zerofree requires the file system to be unmounted or mounted read-only.")
1961 (license license:gpl2)))
1962
1963 (define-public strace
1964 (package
1965 (name "strace")
1966 (version "5.8")
1967 (home-page "https://strace.io")
1968 (source (origin
1969 (method url-fetch)
1970 (uri (string-append home-page "/files/" version
1971 "/strace-" version ".tar.xz"))
1972 (sha256
1973 (base32
1974 "1abs3svkg9985f4jrxx34sj1dcpsf95vv1a0g01c777zgygncjnz"))))
1975 (build-system gnu-build-system)
1976 (arguments
1977 '(#:phases
1978 (modify-phases %standard-phases
1979 (add-after 'unpack 'patch-/bin/sh
1980 (lambda _
1981 (substitute* "strace.c"
1982 (("/bin/sh") (which "sh")))
1983 #t))
1984 (add-after 'unpack 'disable-failing-tests
1985 (lambda _
1986 ;; XXX These hang forever even if the test time-out is extended.
1987 (substitute* "tests/Makefile.in"
1988 (("^\tstrace-DD?D?\\.test \\\\.*") ""))
1989 #t)))
1990 ;; Don't fail if the architecture doesn't support different personalities.
1991 #:configure-flags '("--enable-mpers=check")
1992 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>.
1993 #:parallel-tests? #f)) ; undeterministic failures
1994 (native-inputs `(("perl" ,perl)))
1995 (synopsis "System call tracer for Linux")
1996 (description
1997 "strace is a system call tracer, i.e. a debugging tool which prints out a
1998 trace of all the system calls made by a another process/program.")
1999 (license license:lgpl2.1+)))
2000
2001 (define-public ltrace
2002 (package
2003 (name "ltrace")
2004 (version "0.7.3")
2005 (source (origin
2006 (method url-fetch)
2007 (uri (string-append "http://www.ltrace.org/ltrace_" version
2008 ".orig.tar.bz2"))
2009 (sha256
2010 (base32
2011 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
2012 (build-system gnu-build-system)
2013 (inputs `(("libelf" ,libelf)))
2014 (arguments
2015 ;; Compilation uses -Werror by default, but it fails.
2016 '(#:configure-flags '("--disable-werror")))
2017 (home-page "https://www.ltrace.org/")
2018 (synopsis "Library call tracer for Linux")
2019 (description
2020 "ltrace intercepts and records dynamic library calls which are called by
2021 an executed process and the signals received by that process. It can also
2022 intercept and print the system calls executed by the program.")
2023 (license license:gpl2+)))
2024
2025 (define-public alsa-lib
2026 (package
2027 (name "alsa-lib")
2028 (version "1.2.2")
2029 (source (origin
2030 (method url-fetch)
2031 (uri (string-append
2032 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
2033 version ".tar.bz2"))
2034 (sha256
2035 (base32
2036 "1v5kb8jyvrpkvvq7dq8hfbmcj68lml97i4s0prxpfx2mh3c57s6q"))))
2037 (build-system gnu-build-system)
2038 (arguments
2039 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
2040 (assoc-ref %outputs "out")
2041 "/lib"))))
2042 (home-page "https://www.alsa-project.org/")
2043 (synopsis "The Advanced Linux Sound Architecture libraries")
2044 (description
2045 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2046 MIDI functionality to the Linux-based operating system.")
2047 (license license:lgpl2.1+)))
2048
2049 (define-public alsa-utils
2050 (package
2051 (name "alsa-utils")
2052 (version "1.2.2")
2053 (source (origin
2054 (method url-fetch)
2055 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/"
2056 name "-" version ".tar.bz2"))
2057 (sha256
2058 (base32
2059 "1wz460by17rmxrcydn583rd4lhj6wlvqs6x1j5pdzxn5g3app024"))))
2060 (build-system gnu-build-system)
2061 (arguments
2062 ;; XXX: Disable man page creation until we have DocBook.
2063 '(#:configure-flags (list "--disable-xmlto"
2064
2065 ;; The udev rule is responsible for restoring
2066 ;; the volume.
2067 (string-append "--with-udev-rules-dir="
2068 (assoc-ref %outputs "out")
2069 "/lib/udev/rules.d"))
2070 #:phases
2071 (modify-phases %standard-phases
2072 (add-before 'check 'disable-broken-test
2073 (lambda _
2074 ;; XXX: The 1.1.8 release tarball is missing a header that's
2075 ;; required for this test to work. Fixed in 1.1.9.
2076 (substitute* "axfer/test/Makefile"
2077 ((".*container-test.*") ""))
2078 #t))
2079 (add-before
2080 'install 'pre-install
2081 (lambda _
2082 ;; Don't try to mkdir /var/lib/alsa.
2083 (substitute* "Makefile"
2084 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
2085 "true\n"))
2086 #t)))))
2087 (native-inputs
2088 `(("gettext" ,gettext-minimal)))
2089 (inputs
2090 `(("libsamplerate" ,libsamplerate)
2091 ("ncurses" ,ncurses)
2092 ("alsa-lib" ,alsa-lib)
2093 ("xmlto" ,xmlto)))
2094 (home-page "http://www.alsa-project.org/")
2095 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
2096 (description
2097 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2098 MIDI functionality to the Linux-based operating system.")
2099
2100 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
2101 ;; GPLv2-only.
2102 (license license:gpl2)))
2103
2104 (define-public alsa-plugins
2105 (package
2106 (name "alsa-plugins")
2107 (version "1.2.2")
2108 (source (origin
2109 (method url-fetch)
2110 (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
2111 name "-" version ".tar.bz2"))
2112 (sha256
2113 (base32
2114 "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw"))))
2115 (build-system gnu-build-system)
2116 ;; TODO: Split libavcodec and speex if possible. It looks like they can not
2117 ;; be split, there are references to both in files.
2118 ;; TODO: Remove OSS related plugins, they add support to run native
2119 ;; ALSA applications on OSS however we do not offer OSS and OSS is
2120 ;; obsolete.
2121 (outputs '("out" "pulseaudio" "jack"))
2122 (arguments
2123 `(#:configure-flags '(;; Do not install a "local" configuration targeted
2124 ;; for /etc/alsa. On Guix System plugins are loaded from
2125 ;; the ALSA service, and other distributions likely
2126 ;; won't use these files.
2127 "--with-alsalconfdir=/tmp/noop")
2128 #:phases
2129 (modify-phases %standard-phases
2130 (add-after 'install 'split
2131 (lambda* (#:key inputs outputs #:allow-other-keys)
2132 ;; Distribute the binaries to the various outputs.
2133 (let* ((out (assoc-ref outputs "out"))
2134 (jack (assoc-ref outputs "jack"))
2135 (jacklib (string-append jack "/lib/alsa-lib"))
2136 (pua (assoc-ref outputs "pulseaudio"))
2137 (pualib (string-append pua "/lib/alsa-lib")))
2138 ;; For jack.
2139 (mkdir-p jacklib)
2140 (for-each (lambda (file)
2141 (rename-file file (string-append jacklib "/" (basename file))))
2142 (find-files out ".*jack\\.(la|so)"))
2143 ;; For pulseaudio.
2144 (mkdir-p pualib)
2145 (for-each (lambda (file)
2146 (rename-file file (string-append pualib "/" (basename file))))
2147 (find-files out ".*pulse\\.(la|so)"))
2148 #t))))))
2149 (inputs
2150 `(("alsa-lib" ,alsa-lib)
2151 ("jack" ,jack-1)
2152 ("speex" ,speex) ; libspeexdsp resampling plugin
2153 ("libsamplerate" ,libsamplerate) ; libsamplerate resampling plugin
2154 ("ffmpeg" ,ffmpeg) ; libavcodec resampling plugin, a52 plugin
2155 ("pulseaudio" ,pulseaudio))) ; PulseAudio plugin
2156 (native-inputs
2157 `(("pkg-config" ,pkg-config)))
2158 (home-page "http://www.alsa-project.org/")
2159 (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)")
2160 (description
2161 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2162 MIDI functionality to the Linux-based operating system. This package enhances ALSA
2163 by providing additional plugins which include: upmixing, downmixing, jackd and
2164 pulseaudio support for native alsa applications, format conversion (s16 to a52), and
2165 external rate conversion.")
2166 (license (list license:gpl2+
2167 ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
2168 license:lgpl2.1+))))
2169
2170 (define-public iptables
2171 (package
2172 (name "iptables")
2173 ;; XXX When updating, remove the ‘install-missing-script’ phase.
2174 (version "1.8.5")
2175 (source
2176 (origin
2177 (method url-fetch)
2178 (uri (list (string-append "mirror://netfilter.org/iptables/iptables-"
2179 version ".tar.bz2")
2180 (string-append "https://www.netfilter.org/projects/iptables/"
2181 "files/iptables-" version ".tar.bz2")))
2182 (sha256
2183 (base32 "02a3575ypdpg6a2x752mhk3f7h1381ymkq1n0gss6fp6292xfmyl"))))
2184 (build-system gnu-build-system)
2185 (native-inputs
2186 `(("pkg-config" ,pkg-config)
2187 ("flex" ,flex)
2188 ("bison" ,bison)))
2189 (inputs
2190 `(("libmnl" ,libmnl)
2191 ("libnftnl" ,libnftnl)))
2192 (arguments
2193 '(#:tests? #f ; no test suite
2194 #:configure-flags ; add $libdir to the RUNPATH of executables
2195 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
2196 #:phases
2197 (modify-phases %standard-phases
2198 (add-after 'install 'install-missing-script
2199 ;; A typo prevents installation of /sbin/iptables-apply. It's been
2200 ;; fixed upstream (d4ed0c741fc789bb09d977d74d30875fdd50d08b), but
2201 ;; a patch would require bootstrapping and more inputs. Simply copy
2202 ;; the file ourselves.
2203 (lambda* (#:key outputs #:allow-other-keys)
2204 (let* ((out (assoc-ref outputs "out"))
2205 (sbin (string-append out "/sbin")))
2206 (install-file "iptables/iptables-apply" sbin)
2207 #t))))))
2208 (home-page "https://www.netfilter.org/projects/iptables/index.html")
2209 (synopsis "Programs to configure Linux IP packet filtering rules")
2210 (description
2211 "@command{iptables} is the user-space command line program used to
2212 configure the Linux 2.4.x and later IPv4 packet filtering ruleset
2213 (@dfn{firewall}), including @dfn{NAT} (Network Address Translation).
2214
2215 This package also includes @command{ip6tables}, which is used to configure the
2216 IPv6 packet filter.
2217
2218 Both commands are targeted at system administrators.")
2219 (license license:gpl2+)))
2220
2221 (define-public lsscsi
2222 (package
2223 (name "lsscsi")
2224 (version "0.31")
2225 (source (origin
2226 (method url-fetch)
2227 (uri (string-append
2228 "http://sg.danny.cz/scsi/lsscsi-" version ".tar.xz"))
2229 (sha256
2230 (base32
2231 "1ry2y34xmpgxdbfbyvs8cjmbx0fn222yjdab87wj21q60nab5p75"))))
2232 (build-system gnu-build-system)
2233 (synopsis "Lists information about SCSI or NVMe devices in Linux")
2234 (home-page "http://sg.danny.cz/scsi/lsscsi.html")
2235 (description
2236 "@command{lsscsi} lists SCSI logical units or SCSI targets. It can
2237 also list NVMe namespaces or controllers and show the relationship between a
2238 device's primary node name, its SCSI generic (sg) node name and its kernel
2239 name.")
2240 (license license:gpl2)))
2241
2242 (define-public ebtables
2243 (package
2244 (name "ebtables")
2245 (version "2.0.11")
2246 (source (origin
2247 (method url-fetch)
2248 (uri (string-append
2249 "mirror://netfilter.org/ebtables/ebtables-"
2250 version ".tar.gz"))
2251 (sha256
2252 (base32
2253 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp"))))
2254 (build-system gnu-build-system)
2255 (inputs
2256 `(("perl" ,perl)
2257 ("iptables" ,iptables)))
2258 (synopsis "Ethernet bridge frame table administration")
2259 (home-page "https://ebtables.netfilter.org/")
2260 (description
2261 "ebtables is an application program used to set up and maintain the
2262 tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is
2263 analogous to the iptables application, but less complicated, due to the fact
2264 that the Ethernet protocol is much simpler than the IP protocol.")
2265 (license license:gpl2+)))
2266
2267 (define-public iproute
2268 (package
2269 (name "iproute2")
2270 (version "5.8.0")
2271 (source (origin
2272 (method url-fetch)
2273 (uri (string-append
2274 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
2275 version ".tar.xz"))
2276 (sha256
2277 (base32
2278 "0vk4vickrpahdhl3zazr2qn2bf99v5549ncirjpwiy4h0a4izkfg"))))
2279 (build-system gnu-build-system)
2280 (arguments
2281 `( ;; There is a test suite, but it wants network namespaces and sudo.
2282 #:tests? #f
2283 #:make-flags (let ((out (assoc-ref %outputs "out")))
2284 (list "DESTDIR="
2285 (string-append "BASH_COMPDIR=" out
2286 "/etc/bash_completion.d")
2287 (string-append "LIBDIR=" out "/lib")
2288 (string-append "HDRDIR=" out "/include")
2289 (string-append "SBINDIR=" out "/sbin")
2290 (string-append "CONFDIR=" out "/etc")
2291 (string-append "DOCDIR=" out "/share/doc/"
2292 ,name "-" ,version)
2293 (string-append "MANDIR=" out "/share/man")))
2294 #:phases (modify-phases %standard-phases
2295 (add-before 'install 'pre-install
2296 (lambda _
2297 ;; Don't attempt to create /var/lib/arpd.
2298 (substitute* "Makefile"
2299 (("^.*ARPDDIR.*$") ""))
2300 #t)))))
2301 (inputs
2302 `(("db4" ,bdb)
2303 ("iptables" ,iptables)
2304 ("libmnl" ,libmnl)))
2305 (native-inputs
2306 `(("bison" ,bison)
2307 ("flex" ,flex)
2308 ("pkg-config" ,pkg-config)))
2309 ;; For tests.
2310 ;; ("libmnl" ,libmnl)
2311 ;; ("util-linux" ,util-linux)
2312 (home-page
2313 "https://wiki.linuxfoundation.org/networking/iproute2")
2314 (synopsis
2315 "Utilities for controlling TCP/IP networking and traffic in Linux")
2316 (description
2317 "Iproute2 is a collection of utilities for controlling TCP/IP networking
2318 and traffic with the Linux kernel. The most important of these are
2319 @command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic
2320 control.
2321
2322 Most network configuration manuals still refer to ifconfig and route as the
2323 primary network configuration tools, but ifconfig is known to behave
2324 inadequately in modern network environments, and both should be deprecated.")
2325 (license license:gpl2+)))
2326
2327 (define-public net-tools
2328 ;; XXX: This package is basically unmaintained, but it provides a few
2329 ;; commands not yet provided by Inetutils, such as 'route', so we have to
2330 ;; live with it.
2331 (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b")
2332 (revision "0"))
2333 (package
2334 (name "net-tools")
2335 (version (string-append "1.60-" revision "." (string-take commit 7)))
2336 (source (origin
2337 (method url-fetch)
2338 (uri (string-append "https://sourceforge.net/code-snapshots/git/"
2339 "n/ne/net-tools/code.git/net-tools-code-"
2340 commit ".zip"))
2341 (file-name (string-append name "-" version ".zip"))
2342 (sha256
2343 (base32
2344 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy"))))
2345 (home-page "http://net-tools.sourceforge.net/")
2346 (build-system gnu-build-system)
2347 (arguments
2348 `(#:modules ((guix build gnu-build-system)
2349 (guix build utils)
2350 (srfi srfi-1)
2351 (srfi srfi-26))
2352 #:phases
2353 (modify-phases %standard-phases
2354 (replace 'configure
2355 (lambda* (#:key outputs #:allow-other-keys)
2356 (let ((out (assoc-ref outputs "out")))
2357 (mkdir-p (string-append out "/bin"))
2358 (mkdir-p (string-append out "/sbin"))
2359
2360 ;; Pretend we have everything...
2361 (system "yes | make config")
2362
2363 ;; ... except for the things we don't have.
2364 ;; HAVE_AFDECnet requires libdnet, which we don't have.
2365 ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
2366 ;; that have been removed.
2367 ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should
2368 ;; think about adding them later.
2369 (substitute* '("config.make" "config.h")
2370 (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$")
2371 ""))
2372 #t)))
2373 (add-after 'install 'remove-redundant-commands
2374 (lambda* (#:key outputs #:allow-other-keys)
2375 ;; Remove commands and man pages redundant with Inetutils.
2376 (let* ((out (assoc-ref outputs "out"))
2377 (dup (append-map (cut find-files out <>)
2378 '("^hostname"
2379 "^(yp|nis|dns)?domainname"))))
2380 (for-each delete-file dup)
2381 #t))))
2382 ;; Binaries that depend on libnet-tools.a don't declare that
2383 ;; dependency, making it parallel-unsafe.
2384 #:parallel-build? #f
2385
2386 #:tests? #f ; no test suite
2387 #:make-flags (let ((out (assoc-ref %outputs "out")))
2388 (list ,(string-append "CC=" (cc-for-target))
2389 (string-append "BASEDIR=" out)
2390 (string-append "INSTALLNLSDIR=" out "/share/locale")
2391 (string-append "mandir=/share/man")))))
2392 (native-inputs `(("gettext" ,gettext-minimal)
2393 ("unzip" ,unzip)))
2394 (supported-systems (delete "i586-gnu" %supported-systems))
2395 (synopsis "Tools for controlling the network subsystem in Linux")
2396 (description
2397 "This package includes the important tools for controlling the network
2398 subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and
2399 route. Additionally, this package contains utilities relating to particular
2400 network hardware types (plipconfig, slattach) and advanced aspects of IP
2401 configuration (iptunnel, ipmaddr).")
2402 (license license:gpl2+))))
2403
2404 (define-public libcap
2405 (package
2406 (name "libcap")
2407 (version "2.31")
2408 (source (origin
2409 (method url-fetch)
2410 (uri (string-append
2411 "mirror://kernel.org/linux/libs/security/linux-privs/"
2412 "libcap2/libcap-" version ".tar.xz"))
2413 (sha256
2414 (base32
2415 "0ikwm0kngrqa4ci80lqnrkk17kg09q7dxrz28y0gm5qw3vj8s266"))))
2416 (build-system gnu-build-system)
2417 (arguments '(#:phases
2418 (modify-phases %standard-phases
2419 (replace 'configure
2420 ;; Add $libdir to the RUNPATH of executables.
2421 (lambda _
2422 (substitute* "Make.Rules"
2423 (("LDFLAGS := #-g")
2424 (string-append "LDFLAGS := -Wl,-rpath="
2425 %output "/lib")))
2426 #t)))
2427 #:test-target "test"
2428 #:make-flags (list "lib=lib"
2429 (string-append "prefix="
2430 (assoc-ref %outputs "out"))
2431 "RAISE_SETFCAP=no")))
2432 (native-inputs `(("perl" ,perl)))
2433 (supported-systems (delete "i586-gnu" %supported-systems))
2434 (home-page "https://sites.google.com/site/fullycapable/")
2435 (synopsis "Library for working with POSIX capabilities")
2436 (description
2437 "Libcap2 provides a programming interface to POSIX capabilities on
2438 Linux-based operating systems.")
2439
2440 ;; License is BSD-3 or GPLv2, at the user's choice.
2441 (license license:gpl2)))
2442
2443 ;; libcap 2.31 causes problems for 'fakeroot', so provide this newer variant.
2444 ;; To be merged with libcap on the next rebuild cycle.
2445 (define-public libcap/next
2446 (package
2447 (inherit libcap)
2448 (version "2.34")
2449 (source (origin
2450 (method url-fetch)
2451 (uri (string-append
2452 "mirror://kernel.org/linux/libs/security/linux-privs/"
2453 "libcap2/libcap-" version ".tar.xz"))
2454 (sha256
2455 (base32
2456 "048n1gy2p48vl9hkrr9wymfxxcpwj2aslz2bv79nhl4m2lhd9kdf"))))))
2457
2458 (define-public bridge-utils
2459 (package
2460 (name "bridge-utils")
2461 (version "1.6")
2462 (source
2463 (origin
2464 (method url-fetch)
2465 (uri (string-append "mirror://kernel.org/linux/utils/net/bridge-utils/"
2466 "bridge-utils-" version ".tar.xz"))
2467 (sha256
2468 (base32 "1j16kr44csyr4yqxly26l1yw2bh4nkiasgwvask2i2gvsnsyyryc"))))
2469 (build-system gnu-build-system)
2470
2471 ;; The tarball lacks all the generated files.
2472 (native-inputs `(("autoconf" ,autoconf)
2473 ("automake" ,automake)))
2474 (arguments
2475 '(#:phases
2476 (modify-phases %standard-phases
2477 (add-before 'bootstrap 'patch-stuff
2478 (lambda _
2479 ;; Fix "field ‘ip6’ has incomplete type" errors.
2480 (substitute* "libbridge/libbridge.h"
2481 (("#include <linux/if_bridge.h>")
2482 "#include <linux/in6.h>\n#include <linux/if_bridge.h>"))
2483
2484 ;; Ensure that the entire build fails if one of the
2485 ;; sub-Makefiles fails.
2486 (substitute* "Makefile.in"
2487 (("\\$\\(MAKE\\) \\$\\(MFLAGS\\) -C \\$\\$x ;")
2488 "$(MAKE) $(MFLAGS) -C $$x || exit 1;"))
2489
2490 #t)))
2491 #:tests? #f)) ; no 'check' target
2492
2493 (home-page "https://wiki.linuxfoundation.org/networking/bridge")
2494 (synopsis "Manipulate Ethernet bridges")
2495 (description
2496 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
2497 to connect two Ethernet segments together in a protocol independent way.
2498 Packets are forwarded based on Ethernet address, rather than IP address (like
2499 a router). Since forwarding is done at Layer 2, all protocols can go
2500 transparently through a bridge.")
2501 (license license:gpl2+)))
2502
2503 (define-public libnl
2504 (package
2505 (name "libnl")
2506 (version "3.5.0")
2507 (source (origin
2508 (method url-fetch)
2509 (uri (string-append
2510 "https://github.com/thom311/libnl/releases/download/"
2511 "libnl" (string-join (string-split version #\.) "_")
2512 "/libnl-" version ".tar.gz"))
2513 (sha256
2514 (base32
2515 "1yh5bqmkivd78x378x34gzb28lvykn6b9k3hgvvpdnj5jpn3689m"))))
2516 (build-system gnu-build-system)
2517 (native-inputs
2518 `(("bison" ,bison)
2519 ("flex" ,flex)
2520 ("pkg-config" ,pkg-config)
2521 ("swig" ,swig)
2522 ("libnl3-doc"
2523 ,(origin
2524 (method url-fetch)
2525 (uri (string-append
2526 "https://github.com/thom311/libnl/releases/download/libnl"
2527 (string-join (string-split version #\.) "_")
2528 "/libnl-doc-" version ".tar.gz"))
2529 (sha256
2530 (base32 "19p5y8q3cm5wqvamqc4s5syxnnkvzxy3gw8ivxk6fv9ybn8jm35h"))))))
2531 (outputs `("out" "doc"))
2532 (arguments
2533 `(#:phases
2534 (modify-phases %standard-phases
2535 (add-after 'install 'install-doc
2536 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
2537 (let ((dest (string-append (assoc-ref outputs "doc")
2538 "/share/doc/libnl")))
2539 (mkdir-p dest)
2540 (invoke "tar" "xf" (assoc-ref
2541 (or native-inputs inputs)
2542 "libnl3-doc")
2543 "--strip-components=1" "-C" dest)))))))
2544 (home-page "https://www.infradead.org/~tgr/libnl/")
2545 (synopsis "NetLink protocol library suite")
2546 (description
2547 "The libnl suite is a collection of libraries providing APIs to netlink
2548 protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily
2549 between the kernel and user space processes. It was designed to be a more
2550 flexible successor to ioctl to provide mainly networking related kernel
2551 configuration and monitoring interfaces.")
2552
2553 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
2554 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
2555 (license license:gpl2)))
2556
2557 ;; libnl python extensions used to be outputs of libnl. However, as
2558 ;; cross-compiling python extensions is currently broken, create separate
2559 ;; packages for libnl python extensions.
2560 (define (libnl-python-package python)
2561 (let ((name (string-append "libnl-" python)))
2562 (package
2563 (inherit libnl)
2564 (name name)
2565 (inputs `(,@(cond
2566 ((string=? python "python2")
2567 `(("python-2" ,python-2)))
2568 ((string=? python "python3")
2569 `(("python-3" ,python-3))))))
2570 (propagated-inputs `(("libnl" ,libnl)))
2571 (outputs '("out"))
2572 (arguments
2573 `(#:modules ((guix build gnu-build-system)
2574 (guix build utils)
2575 (srfi srfi-1))
2576 #:phases
2577 (modify-phases %standard-phases
2578 (replace 'install
2579 (lambda* (#:key inputs outputs #:allow-other-keys)
2580 (define (python-inst python)
2581 (invoke python "setup.py" "build")
2582 (invoke python "setup.py" "install"
2583 (string-append "--prefix="
2584 (assoc-ref %outputs "out")))
2585 (invoke python "setup.py" "clean"))
2586 (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
2587 (assoc-ref inputs "libnl")))
2588 (with-directory-excursion "./python" (python-inst ,python))
2589 #t))))))))
2590
2591 (define-public libnl-python2 (libnl-python-package "python2"))
2592 (define-public libnl-python3 (libnl-python-package "python3"))
2593
2594 (define-public iw
2595 (package
2596 (name "iw")
2597 (version "4.14")
2598 (source (origin
2599 (method url-fetch)
2600 (uri (string-append
2601 "mirror://kernel.org/software/network/iw/iw-"
2602 version ".tar.xz"))
2603 (sha256
2604 (base32
2605 "12ddd6vh6vs97135bnlyr0szv7hvpbnmfh48584frzab0z0725ph"))))
2606 (build-system gnu-build-system)
2607 (native-inputs `(("pkg-config" ,pkg-config)))
2608 (inputs `(("libnl" ,libnl)))
2609 (arguments
2610 `(#:make-flags
2611 (let* ((target ,(%current-target-system))
2612 (pkg-config (if target
2613 (string-append target "-pkg-config")
2614 "pkg-config")))
2615 (list
2616 ,(string-append "CC=" (cc-for-target))
2617 (string-append "PKG_CONFIG="
2618 (assoc-ref %build-inputs "pkg-config")
2619 "/bin/" pkg-config)
2620 (string-append "PREFIX=" (assoc-ref %outputs "out"))))
2621 #:phases (modify-phases %standard-phases (delete 'configure))))
2622 (home-page "https://wireless.wiki.kernel.org/")
2623 (synopsis "Tool for configuring wireless devices")
2624 (description
2625 "iw is a new nl80211 based CLI configuration utility for wireless
2626 devices. It replaces @code{iwconfig}, which is deprecated.")
2627 (license license:isc)))
2628
2629 (define-public powertop
2630 (package
2631 (name "powertop")
2632 (version "2.13")
2633 (source
2634 (origin
2635 (method url-fetch)
2636 (uri (string-append "https://01.org/sites/default/files/downloads/"
2637 "powertop-" version ".tar.gz"))
2638 (sha256
2639 (base32 "0y1ixw8v17fdb1ima0zshrd0rh4zxdh10r93nrrvq6d4lhn9jpx6"))))
2640 (build-system gnu-build-system)
2641 (arguments
2642 '(#:phases
2643 (modify-phases %standard-phases
2644 ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
2645 ;; allow calibrating the network interface in Guix System.
2646 (add-after 'unpack 'patch-absolute-file-names
2647 (lambda* (#:key inputs #:allow-other-keys)
2648 (let ((kmod (assoc-ref inputs "kmod")))
2649 (substitute* (find-files "src" "\\.cpp$")
2650 ;; Give the right 'modprobe' file name so that essential
2651 ;; modules such as msr.ko can be loaded.
2652 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
2653 ;; These programs are only needed to calibrate, so using
2654 ;; relative file names avoids adding extra inputs. When they
2655 ;; are missing powertop gracefully handles it.
2656 (("/usr/bin/hcitool") "hcitool")
2657 (("/usr/bin/xset") "xset")
2658 (("/usr/sbin/hciconfig") "hciconfig"))
2659 #t))))))
2660 (inputs
2661 `(("kmod" ,kmod)
2662 ("libnl" ,libnl)
2663 ("ncurses" ,ncurses)
2664 ("pciutils" ,pciutils)
2665 ("zlib" ,zlib)))
2666 (native-inputs
2667 `(("pkg-config" ,pkg-config)))
2668 (home-page "https://01.org/powertop/")
2669 (synopsis "Analyze power consumption on Intel-based laptops")
2670 (description
2671 "PowerTOP is a Linux tool to diagnose issues with power consumption and
2672 power management. In addition to being a diagnostic tool, PowerTOP also has
2673 an interactive mode where the user can experiment various power management
2674 settings for cases where the operating system has not enabled these
2675 settings.")
2676 (license license:gpl2)))
2677
2678 (define-public aumix
2679 (package
2680 (name "aumix")
2681 (version "2.9.1")
2682 (source (origin
2683 (method url-fetch)
2684 (uri (string-append
2685 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
2686 version ".tar.bz2"))
2687 (sha256
2688 (base32
2689 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
2690 (build-system gnu-build-system)
2691 (inputs `(("ncurses" ,ncurses)))
2692 (home-page "http://www.jpj.net/~trevor/aumix.html")
2693 (synopsis "Audio mixer for X and the console")
2694 (description
2695 "Aumix adjusts an audio mixer from X, the console, a terminal,
2696 the command line or a script.")
2697 (license license:gpl2+)))
2698
2699 (define-public iotop
2700 (package
2701 (name "iotop")
2702 (version "0.6")
2703 (source
2704 (origin
2705 (method url-fetch)
2706 (uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
2707 version ".tar.gz"))
2708 (sha256 (base32
2709 "1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
2710 (build-system python-build-system)
2711 (arguments
2712 '(#:phases
2713 (modify-phases %standard-phases
2714 (add-after 'unpack 'fix-build-with-python3
2715 (lambda _
2716 (substitute* "setup.py"
2717 (("itervalues") "values"))
2718 #t)))
2719 ;; There are currently no checks in the package.
2720 #:tests? #f))
2721 (native-inputs `(("python" ,python)))
2722 (home-page "http://guichaz.free.fr/iotop/")
2723 (synopsis
2724 "Displays the IO activity of running processes")
2725 (description
2726 "Iotop is a Python program with a top like user interface to show the
2727 processes currently causing I/O.")
2728 (license license:gpl2+)))
2729
2730 (define-public fuse
2731 (package
2732 (name "fuse")
2733 (version "2.9.9")
2734 (source (origin
2735 (method url-fetch)
2736 (uri (string-append "https://github.com/libfuse/libfuse/releases/"
2737 "download/fuse-" version
2738 "/fuse-" version ".tar.gz"))
2739 (sha256
2740 (base32
2741 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh"))
2742 (patches (search-patches "fuse-overlapping-headers.patch"))))
2743 (build-system gnu-build-system)
2744 (inputs `(("util-linux" ,util-linux)))
2745 (arguments
2746 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
2747 (assoc-ref %outputs "out")
2748 "/sbin")
2749 (string-append "INIT_D_PATH="
2750 (assoc-ref %outputs "out")
2751 "/etc/init.d")
2752
2753 ;; The rule makes /dev/fuse 666.
2754 (string-append "UDEV_RULES_PATH="
2755 (assoc-ref %outputs "out")
2756 "/lib/udev/rules.d"))
2757 #:phases
2758 (modify-phases %standard-phases
2759 (add-before 'build 'set-file-names
2760 (lambda* (#:key inputs #:allow-other-keys)
2761 ;; libfuse calls out to mount(8) and umount(8). Make sure
2762 ;; it refers to the right ones.
2763 (substitute* '("lib/mount_util.c" "util/mount_util.c")
2764 (("/bin/(u?)mount" _ maybe-u)
2765 (string-append (assoc-ref inputs "util-linux")
2766 "/bin/" maybe-u "mount")))
2767 (substitute* '("util/mount.fuse.c")
2768 (("/bin/sh")
2769 (which "sh")))
2770
2771 ;; This hack leads libfuse to search for 'fusermount' in
2772 ;; $PATH, where it may find a setuid-root binary, instead of
2773 ;; trying solely $out/sbin/fusermount and failing because
2774 ;; it's not setuid.
2775 (substitute* "lib/Makefile"
2776 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
2777 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\""))
2778 #t)))))
2779 (supported-systems (delete "i586-gnu" %supported-systems))
2780 (home-page "https://github.com/libfuse/libfuse")
2781 (synopsis "Support file systems implemented in user space")
2782 (description
2783 "As a consequence of its monolithic design, file system code for Linux
2784 normally goes into the kernel itself---which is not only a robustness issue,
2785 but also an impediment to system extensibility. FUSE, for \"file systems in
2786 user space\", is a kernel module and user-space library that tries to address
2787 part of this problem by allowing users to run file system implementations as
2788 user-space processes.")
2789 (license (list license:lgpl2.1 ;library
2790 license:gpl2+)))) ;command-line utilities
2791
2792 (define-public unionfs-fuse
2793 (package
2794 (name "unionfs-fuse")
2795 (version "2.0")
2796 (source (origin
2797 (method git-fetch)
2798 (uri (git-reference
2799 (url "https://github.com/rpodgorny/unionfs-fuse")
2800 (commit (string-append "v" version))))
2801 (file-name (git-file-name name version))
2802 (sha256
2803 (base32
2804 "0lb8zgdxnjy2fjr2284hvdfn7inc1in44ynzgcr66x54bxzvynj6"))))
2805 (build-system cmake-build-system)
2806 (native-inputs
2807 `(("python" ,python)))
2808 (inputs `(("fuse" ,fuse)))
2809 (arguments
2810 ;; The tests were never actually run ("collected 0 items"), but in recent
2811 ;; versions of pytest that causes an error.
2812 '(#:tests? #f))
2813 (home-page "https://github.com/rpodgorny/unionfs-fuse")
2814 (synopsis "User-space union file system")
2815 (description
2816 "UnionFS-FUSE is a flexible union file system implementation in user
2817 space, using the FUSE library. Mounting a union file system allows you to
2818 \"aggregate\" the contents of several directories into a single mount point.
2819 UnionFS-FUSE additionally supports copy-on-write.")
2820 (license license:bsd-3)))
2821
2822 (define fuse-static
2823 (package (inherit fuse)
2824 (name "fuse-static")
2825 (source (origin (inherit (package-source fuse))
2826 (modules '((guix build utils)))
2827 (snippet
2828 '(begin
2829 ;; Normally libfuse invokes mount(8) so that /etc/mtab is
2830 ;; updated. Change calls to 'mtab_needs_update' to 0 so
2831 ;; that it doesn't do that, allowing us to remove the
2832 ;; dependency on util-linux (something that is useful in
2833 ;; initrds.)
2834 (substitute* '("lib/mount_util.c"
2835 "util/mount_util.c")
2836 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
2837 "0")
2838 (("/bin/")
2839 ""))
2840 #t))))))
2841
2842 (define-public unionfs-fuse/static
2843 (package (inherit unionfs-fuse)
2844 (synopsis "User-space union file system (statically linked)")
2845 (name (string-append (package-name unionfs-fuse) "-static"))
2846 (source (origin (inherit (package-source unionfs-fuse))
2847 (modules '((guix build utils)))
2848 (snippet
2849 '(begin
2850 ;; Add -ldl to the libraries, because libfuse.a needs that.
2851 (substitute* "src/CMakeLists.txt"
2852 (("target_link_libraries(.*)\\)" _ libs)
2853 (string-append "target_link_libraries"
2854 libs " dl)")))
2855 #t))))
2856 (arguments
2857 '(#:tests? #f
2858 #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
2859 #:phases
2860 (modify-phases %standard-phases
2861 (add-after 'install 'post-install
2862 (lambda* (#:key outputs #:allow-other-keys)
2863 (let* ((out (assoc-ref outputs "out"))
2864 (exe (string-append out "/bin/unionfs")))
2865 ;; By default, 'unionfs' keeps references to
2866 ;; $glibc/share/locale and similar stuff. Remove them.
2867 (remove-store-references exe)
2868
2869 ;; 'unionfsctl' has references to glibc as well. Since
2870 ;; we don't need it, remove it.
2871 (delete-file (string-append out "/bin/unionfsctl"))
2872 #t))))))
2873 (inputs `(("fuse" ,fuse-static)))))
2874
2875 (define-public sshfs
2876 (package
2877 (name "sshfs")
2878 (version "2.10")
2879 (source (origin
2880 (method url-fetch)
2881 (uri (string-append "https://github.com/libfuse/sshfs/releases/"
2882 "download/sshfs-" version "/sshfs-" version
2883 ".tar.gz"))
2884 (sha256
2885 (base32
2886 "00fir2iykdx11g8nv5gijg0zjrp2g3ldypnv0yi6lq3h5pg5v13h"))))
2887 (build-system gnu-build-system)
2888 (inputs
2889 `(("fuse" ,fuse)
2890 ("glib" ,glib)))
2891 (native-inputs
2892 `(("pkg-config" ,pkg-config)))
2893 (home-page "https://github.com/libfuse/sshfs")
2894 (synopsis "Mount remote file systems over SSH")
2895 (description
2896 "This is a file system client based on the SSH File Transfer Protocol.
2897 Since most SSH servers already support this protocol it is very easy to set
2898 up: on the server side there's nothing to do; on the client side mounting the
2899 file system is as easy as logging into the server with an SSH client.")
2900 (license license:gpl2+)))
2901
2902 (define-public sshfs-fuse
2903 (package (inherit sshfs)
2904 (name "sshfs-fuse")
2905 (properties `((superseded . ,sshfs)))))
2906
2907 (define-public archivemount
2908 (package
2909 (name "archivemount")
2910 (version "0.8.12")
2911 (source
2912 (origin
2913 (method url-fetch)
2914 (uri (string-append "https://www.cybernoia.de/software/archivemount/"
2915 "archivemount-" version ".tar.gz"))
2916 (sha256
2917 (base32 "12fb8fcmd1zwvfgzx4pay47md5cr2kgxcgq82cm6skmq75alfzi4"))))
2918 (build-system gnu-build-system)
2919 (inputs `(("fuse" ,fuse)
2920 ("libarchive" ,libarchive)))
2921 (native-inputs `(("pkg-config" ,pkg-config)))
2922 (home-page "https://www.cybernoia.de/software/archivemount.html")
2923 (synopsis "Tool for mounting archive files with FUSE")
2924 (description "archivemount is a FUSE-based file system for Unix variants,
2925 including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a
2926 mount point where it can be read from or written to as with any other file
2927 system. This makes accessing the contents of the archive, which may be
2928 compressed, transparent to other programs, without decompressing them.")
2929 (license license:lgpl2.0+)))
2930
2931 (define-public numactl
2932 (package
2933 (name "numactl")
2934 (version "2.0.13")
2935 (source (origin
2936 (method url-fetch)
2937 (uri (string-append
2938 "https://github.com/numactl/numactl/releases/download/v"
2939 version "/numactl-" version ".tar.gz"))
2940 (sha256
2941 (base32
2942 "16lcypvcmx1ydkpi2s82kqhg13kak7qhpbnj8hd9bdbyhr5ja7lr"))))
2943 (build-system gnu-build-system)
2944 (arguments
2945 '(;; There's a 'test' target, but it requires NUMA support in the kernel
2946 ;; to run, which we can't assume to have.
2947 #:tests? #f))
2948
2949 ;; NUMA is apparently not supported on armhf, see
2950 ;; http://www.spinics.net/lists/linux-numa/msg01157.html
2951 (supported-systems (delete "armhf-linux" %supported-systems))
2952 (home-page "https://github.com/numactl/numactl")
2953 (synopsis "Tools for non-uniform memory access (NUMA) machines")
2954 (description
2955 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
2956 memory is not all in one place. The @command{numactl} program allows you to
2957 run your application program on specific CPUs and memory nodes. It does this
2958 by supplying a NUMA memory policy to the operating system before running your
2959 program.
2960
2961 The package contains other commands, such as @command{numastat},
2962 @command{memhog}, and @command{numademo} which provides a quick overview of
2963 NUMA performance on your system.")
2964 (license (list license:gpl2 ;programs
2965 license:lgpl2.1)))) ;library
2966
2967 (define-public kbd-neo
2968 (package
2969 (name "kbd-neo")
2970 (version "2486")
2971 (source
2972 (origin
2973 (method url-fetch)
2974 (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
2975 version "/linux/console/neo.map"))
2976 (file-name (string-append name "-" version ".map"))
2977 (sha256
2978 (base32
2979 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
2980 (build-system trivial-build-system)
2981 (arguments
2982 `(#:modules ((guix build utils))
2983 #:builder (begin
2984 (use-modules (guix build utils))
2985 (let ((out (string-append %output "/share/keymaps"))
2986 (source (assoc-ref %build-inputs "source")))
2987 (mkdir-p out)
2988 (copy-file source (string-append out "/neo.map"))
2989 #t))))
2990 (home-page "https://neo-layout.org")
2991 (synopsis "Neo2 console layout")
2992 (description
2993 "Kbd-neo provides the Neo2 keyboard layout for use with
2994 @command{loadkeys(1)} from @code{kbd(4)}.")
2995 ;; The file is located in an svn directory, the entire content of
2996 ;; the directory is licensed as GPL3.
2997 (license license:gpl3+)))
2998
2999 (define-public kbd
3000 (package
3001 (name "kbd")
3002 (version "2.0.4")
3003 (source (origin
3004 (method url-fetch)
3005 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
3006 version ".tar.xz"))
3007 (sha256
3008 (base32
3009 "124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz"))
3010 (modules '((guix build utils)))
3011 (snippet
3012 '(begin
3013 (substitute* "tests/Makefile.in"
3014 ;; The '%: %.in' rule incorrectly uses @VERSION@.
3015 (("@VERSION@")
3016 "[@]VERSION[@]"))
3017 (substitute* '("src/unicode_start" "src/unicode_stop")
3018 ;; Assume the Coreutils are in $PATH.
3019 (("/usr/bin/tty")
3020 "tty"))
3021 #t))))
3022 (build-system gnu-build-system)
3023 (arguments
3024 '(#:phases
3025 (modify-phases %standard-phases
3026 (add-before 'build 'pre-build
3027 (lambda* (#:key inputs #:allow-other-keys)
3028 (let ((gzip (assoc-ref %build-inputs "gzip"))
3029 (bzip2 (assoc-ref %build-inputs "bzip2")))
3030 (substitute* "src/libkeymap/findfile.c"
3031 (("gzip")
3032 (string-append gzip "/bin/gzip"))
3033 (("bzip2")
3034 (string-append bzip2 "/bin/bzip2")))
3035 #t)))
3036 (add-after 'install 'post-install
3037 (lambda* (#:key outputs #:allow-other-keys)
3038 ;; Make sure these programs find their comrades.
3039 (let* ((out (assoc-ref outputs "out"))
3040 (bin (string-append out "/bin")))
3041 (for-each (lambda (prog)
3042 (wrap-program (string-append bin "/" prog)
3043 `("PATH" ":" prefix (,bin))))
3044 '("unicode_start" "unicode_stop"))
3045 #t))))))
3046 (inputs `(("check" ,check)
3047 ("gzip" ,gzip)
3048 ("bzip2" ,bzip2)
3049 ("pam" ,linux-pam)))
3050 (native-search-paths
3051 (list (search-path-specification
3052 (variable "LOADKEYS_KEYMAP_PATH")
3053 ;; Append ‘/**’ to recursively search all directories. One can then
3054 ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
3055 ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard.
3056 (files (list "share/keymaps/**")))))
3057 (native-inputs `(("pkg-config" ,pkg-config)))
3058 (home-page "http://kbd-project.org/")
3059 (synopsis "Linux keyboard utilities and keyboard maps")
3060 (description
3061 "This package contains keytable files and keyboard utilities compatible
3062 for systems using the Linux kernel. This includes commands such as
3063 @code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.")
3064 (license license:gpl2+)))
3065
3066 (define-public loadkeys-static
3067 (package
3068 (inherit kbd)
3069 (name "loadkeys-static")
3070 (arguments
3071 (substitute-keyword-arguments (package-arguments kbd)
3072 ((#:configure-flags flags ''())
3073 `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
3074 "--disable-vlock" ;so we don't need libpam
3075 "--disable-libkeymap")
3076 ,flags))
3077 ((#:make-flags flags ''())
3078 `(cons "LDFLAGS=-all-static" ,flags))
3079 ((#:phases phases '%standard-phases)
3080 `(modify-phases ,phases
3081 (replace 'install
3082 (lambda* (#:key outputs #:allow-other-keys)
3083 (let ((out (assoc-ref outputs "out")))
3084 ;; The binary keeps references to gzip, among other things,
3085 ;; which we don't need in the initrd, so strip references.
3086 (remove-store-references "src/loadkeys")
3087
3088 (install-file "src/loadkeys"
3089 (string-append out "/bin"))
3090 #t)))
3091 (delete 'post-install)))
3092 ((#:strip-flags _ '())
3093 ''("--strip-all"))
3094 ((#:allowed-references _ '())
3095 '())))
3096
3097 (synopsis "Statically-linked @command{loadkeys} program")
3098
3099 ;; This package is meant to be used internally in the initrd so don't
3100 ;; expose it.
3101 (properties '((hidden? . #t)))))
3102
3103 (define-public inotify-tools
3104 (package
3105 (name "inotify-tools")
3106 (version "3.20.2.2")
3107 (source (origin
3108 (method git-fetch)
3109 (uri (git-reference
3110 (url "https://github.com/rvoicilas/inotify-tools")
3111 (commit version)))
3112 (file-name (git-file-name name version))
3113 (sha256
3114 (base32
3115 "1r12bglkb0bkqff6kgxjm81hk6z20nrxq3m7iv15d4nrqf9pm7s0"))))
3116 (build-system gnu-build-system)
3117 (native-inputs
3118 `(("autoconf" ,autoconf)
3119 ("automake" ,automake)
3120 ("libtool" ,libtool)))
3121 (home-page "https://github.com/rvoicilas/inotify-tools/wiki")
3122 (synopsis "Monitor file accesses")
3123 (description
3124 "The inotify-tools packages provides a C library and command-line tools
3125 to use Linux' inotify mechanism, which allows file accesses to be monitored.")
3126 (license license:gpl2+)))
3127
3128 (define-public kmod
3129 (package
3130 (name "kmod")
3131 (version "27")
3132 (source (origin
3133 (method url-fetch)
3134 (uri
3135 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
3136 "kmod-" version ".tar.xz"))
3137 (sha256
3138 (base32
3139 "035wzfzjx4nwidk747p8n085mgkvy531ppn16krrajx2dkqzply1"))
3140 (patches (search-patches "kmod-module-directory.patch"))))
3141 (build-system gnu-build-system)
3142 (native-inputs
3143 `(("pkg-config" ,pkg-config)))
3144 (inputs
3145 `(("xz" ,xz)
3146 ("zlib" ,zlib)))
3147 (arguments
3148 `(#:configure-flags '("--with-xz" "--with-zlib"
3149 "--disable-test-modules")
3150 #:phases
3151 (modify-phases %standard-phases
3152 (add-after 'unpack 'disable-tests
3153 (lambda _
3154 ;; XXX: These tests need '--sysconfdir=/etc' to pass.
3155 (substitute* "Makefile.in"
3156 (("testsuite/test-modprobe") "")
3157 (("testsuite/test-depmod") "")
3158 (("testsuite/test-blacklist") ""))
3159 #t))
3160 (add-after 'install 'install-modprobe&co
3161 (lambda* (#:key outputs #:allow-other-keys)
3162 (let* ((out (assoc-ref outputs "out"))
3163 (bin (string-append out "/bin")))
3164 (for-each (lambda (tool)
3165 (symlink "kmod"
3166 (string-append bin "/" tool)))
3167 '("insmod" "rmmod" "lsmod" "modprobe"
3168 "modinfo" "depmod"))
3169 #t))))))
3170 (supported-systems (delete "i586-gnu" %supported-systems))
3171 (home-page "https://www.kernel.org/")
3172 (synopsis "Kernel module tools")
3173 (description "Kmod is a set of tools to handle common tasks with Linux
3174 kernel modules like insert, remove, list, check properties, resolve
3175 dependencies and aliases.
3176
3177 These tools are designed on top of libkmod, a library that is shipped with
3178 kmod. The aim is to be compatible with tools, configurations and indices
3179 from the module-init-tools project.")
3180 (license license:gpl2+))) ; library under lgpl2.1+
3181
3182 (define-public earlyoom
3183 (package
3184 (name "earlyoom")
3185 (version "1.3.1")
3186 (source (origin
3187 (method git-fetch)
3188 (uri (git-reference
3189 (url "https://github.com/rfjakob/earlyoom")
3190 (commit (string-append "v" version))))
3191 (file-name (git-file-name name version))
3192 (sha256
3193 (base32
3194 "06sd3jpkdrwqbphsf8jrgs5rxfi7j3xjmygjjvj4xjk4gncz7r2i"))))
3195 (build-system gnu-build-system)
3196 (arguments
3197 `(#:phases (modify-phases %standard-phases
3198 (delete 'configure)
3199 (add-before 'check 'set-home
3200 (lambda _
3201 (setenv "HOME" (getcwd))
3202 #t))
3203 (add-after 'build 'install-contribs
3204 ;; Install what seems useful from the contrib directory.
3205 (lambda* (#:key outputs #:allow-other-keys)
3206 (let* ((out (assoc-ref outputs "out"))
3207 (contrib (string-append
3208 out "/share/earlyoom/contrib")))
3209 (install-file "contrib/notify_all_users.py" contrib)
3210 #t))))
3211 #:make-flags (let* ((prefix (assoc-ref %outputs "out")))
3212 (list ,(string-append "CC=" (cc-for-target))
3213 (string-append "VERSION=v" ,version)
3214 (string-append "PREFIX=" prefix)
3215 (string-append "SYSCONFDIR=" prefix "/etc")))
3216 #:test-target "test"))
3217 (native-inputs `(("go" ,go) ;for the test suite
3218 ("pandoc" ,pandoc))) ;to generate the manpage
3219 (home-page "https://github.com/rfjakob/earlyoom")
3220 (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
3221 (description "Early OOM is a minimalist out of memory (OOM) daemon that
3222 runs in user space and provides a more responsive and configurable alternative
3223 to the in-kernel OOM killer.")
3224 (license license:expat)))
3225
3226 (define-public eudev
3227 ;; The post-systemd fork, maintained by Gentoo.
3228 (package
3229 (name "eudev")
3230 (version "3.2.9")
3231 (source (origin
3232 (method git-fetch)
3233 (uri (git-reference (url "https://github.com/gentoo/eudev")
3234 (commit (string-append "v" version))))
3235 (file-name (git-file-name name version))
3236 (sha256
3237 (base32
3238 "1g9z3d33m0i3hmbhm0wxpvkzf6ac7xj1drwcfrhzlfhhi63sg9h7"))
3239 (patches (search-patches "eudev-rules-directory.patch"))))
3240 (build-system gnu-build-system)
3241 (arguments
3242 `(#:phases
3243 (modify-phases %standard-phases
3244 (add-after 'unpack 'make-source-writable
3245 (lambda _
3246 ;; XXX: Git checkouts are read-only, but this package needs to
3247 ;; modify some of its files.
3248 (for-each make-file-writable (find-files "."))
3249 #t))
3250 (add-before 'bootstrap 'patch-file-names
3251 (lambda* (#:key inputs native-inputs #:allow-other-keys)
3252 (substitute* "man/make.sh"
3253 (("/usr/bin/xsltproc")
3254 (string-append (assoc-ref
3255 (or native-inputs inputs) "xsltproc")
3256 "/bin/xsltproc")))
3257 #t))
3258 (add-before 'configure 'patch-bindir-in-btrfs-rules
3259 (lambda* (#:key outputs #:allow-other-keys)
3260 ;; The "@bindir@" substitution incorrectly expands to a literal
3261 ;; "${exec_prefix}" (see <https://bugs.gnu.org/39926>). Work
3262 ;; around it.
3263 (let ((out (assoc-ref outputs "out")))
3264 (substitute* "rules/64-btrfs.rules.in"
3265 (("@bindir@")
3266 (string-append out "/bin")))
3267 #t)))
3268 (add-after 'install 'move-static-library
3269 (lambda* (#:key outputs #:allow-other-keys)
3270 (let* ((out (assoc-ref outputs "out"))
3271 (static (assoc-ref outputs "static"))
3272 (source (string-append out "/lib/libudev.a"))
3273 (target (string-append static "/lib/libudev.a")))
3274 (mkdir-p (dirname target))
3275 (link source target)
3276 (delete-file source)
3277 ;; Remove reference to the static library from the .la file
3278 ;; such that Libtool looks for it in the usual places.
3279 (substitute* (string-append out "/lib/libudev.la")
3280 (("old_library=.*")
3281 "old_library=''\n"))
3282 #t)))
3283 (add-after 'install 'build-hwdb
3284 (lambda* (#:key outputs #:allow-other-keys)
3285 ;; Build OUT/etc/udev/hwdb.bin. This allows 'lsusb' and
3286 ;; similar tools to display product names.
3287 ;;
3288 ;; XXX: This can't be done when cross-compiling. Find another way
3289 ;; to generate hwdb.bin for cross-built systems.
3290 (let ((out (assoc-ref outputs "out")))
3291 ,@(if (%current-target-system)
3292 '(#t)
3293 '((invoke (string-append out "/bin/udevadm")
3294 "hwdb" "--update")))))))
3295 #:configure-flags (list "--enable-manpages")))
3296 (native-inputs
3297 `(("autoconf" ,autoconf)
3298 ("automake" ,automake)
3299 ("gperf" ,gperf)
3300 ("libtool" ,libtool)
3301 ("pkg-config" ,pkg-config)
3302 ;; For tests.
3303 ("perl" ,perl)
3304 ("python" ,python-wrapper)
3305 ;; For documentation.
3306 ("docbook-xml" ,docbook-xml-4.2)
3307 ("docbook-xsl" ,docbook-xsl)
3308 ("libxml2" ,libxml2) ;for $XML_CATALOG_FILES
3309 ("xsltproc" ,libxslt)))
3310 (inputs
3311 ;; When linked against libblkid, eudev can populate /dev/disk/by-label
3312 ;; and similar; it also installs the '60-persistent-storage.rules' file,
3313 ;; which contains the rules to do that.
3314 `(("util-linux" ,util-linux "lib") ;for blkid
3315 ("kmod" ,kmod)))
3316 (outputs '("out" "static"))
3317 (home-page "https://wiki.gentoo.org/wiki/Project:Eudev")
3318 (synopsis "Userspace device management")
3319 (description "Udev is a daemon which dynamically creates and removes
3320 device nodes from /dev/, handles hotplug events and loads drivers at boot
3321 time.")
3322 (license license:gpl2+)))
3323
3324 (define-public python-evdev
3325 (package
3326 (name "python-evdev")
3327 (version "1.3.0")
3328 (source
3329 (origin
3330 (method url-fetch)
3331 (uri (pypi-uri "evdev" version))
3332 (sha256
3333 (base32 "0kb3636yaw9l8xi8s184w0r0n9ic5dw3b8hx048jf9fpzss4kimi"))))
3334 (build-system python-build-system)
3335 (native-inputs
3336 `(("kernel-headers" ,linux-libre-headers)))
3337 (arguments
3338 `(#:tests? #f ;no rule for tests
3339 #:phases
3340 (modify-phases %standard-phases
3341 (add-before 'build 'fix-hard-coded-directory
3342 (lambda* (#:key inputs #:allow-other-keys)
3343 (substitute* "setup.py"
3344 (("/usr/include/linux")
3345 (string-append
3346 (assoc-ref inputs "kernel-headers") "/include/linux")))
3347 #t)))))
3348 (home-page "https://github.com/gvalkov/python-evdev")
3349 (synopsis "Bindings to the Linux input handling subsystem")
3350 (description
3351 "Python-evdev provides bindings to the generic input event interface in
3352 Linux. The @code{evdev} interface serves the purpose of passing events
3353 generated in the kernel directly to userspace through character devices that
3354 are typically located in @file{/dev/input/}.
3355
3356 This package also comes with bindings to @code{uinput}, the userspace input
3357 subsystem. @code{uinput} allows userspace programs to create and handle input
3358 devices that can inject events directly into the input subsystem.")
3359 (license license:bsd-3)))
3360
3361 (define-public lvm2
3362 (package
3363 (name "lvm2")
3364 (version "2.03.10")
3365 (source (origin
3366 (method url-fetch)
3367 (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2."
3368 version ".tgz")
3369 (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
3370 version ".tgz")))
3371 (sha256
3372 (base32
3373 "1l0fkn9abrgk5mfn6jfh9qhdr86b59l1c5pk6lp8jh0491d69las"))
3374 (modules '((guix build utils)))
3375 (snippet
3376 '(begin
3377 (use-modules (guix build utils))
3378
3379 ;; Honor sysconfdir.
3380 (substitute* "make.tmpl.in"
3381 (("^confdir = .*$")
3382 "confdir = @sysconfdir@\n")
3383 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
3384 "DEFAULT_SYS_DIR = @sysconfdir@"))
3385 #t))
3386 (patches (search-patches "lvm2-static-link.patch"))))
3387 (build-system gnu-build-system)
3388 (native-inputs
3389 `(("pkg-config" ,pkg-config)
3390 ("procps" ,procps))) ;tests use 'pgrep'
3391 (inputs
3392 `(("libaio" ,libaio)
3393 ("udev" ,eudev)))
3394 (arguments
3395 `(#:phases
3396 (modify-phases %standard-phases
3397 (add-after 'configure 'set-makefile-shell
3398 (lambda _
3399 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
3400 ;; expected.
3401 (setenv "SHELL" (which "sh"))
3402
3403 ;; Replace /bin/sh with the right file name.
3404 (patch-makefile-SHELL "make.tmpl")
3405 #t)))
3406
3407 #:configure-flags (list (string-append "--sysconfdir="
3408 (assoc-ref %outputs "out")
3409 "/etc/lvm")
3410 "--enable-udev_sync"
3411 "--enable-udev_rules"
3412 "--enable-pkgconfig"
3413 "--enable-cmdlib"
3414 "--enable-dmeventd" ; Requires '--enable-cmdlib'.
3415
3416 ;; Make sure programs such as 'dmsetup' can
3417 ;; find libdevmapper.so.
3418 (string-append "LDFLAGS=-Wl,-rpath="
3419 (assoc-ref %outputs "out")
3420 "/lib,-rpath="
3421 (assoc-ref %outputs "out")
3422 "/lib/device-mapper")
3423 ;; This is needed when cross-compiling.
3424 ,@(if (%current-target-system)
3425 '("ac_cv_func_malloc_0_nonnull=yes"
3426 "ac_cv_func_realloc_0_nonnull=yes")
3427 '()))
3428
3429 ;; The tests use 'mknod', which requires root access.
3430 #:tests? #f))
3431 (supported-systems (delete "i586-gnu" %supported-systems))
3432 (home-page "https://sourceware.org/lvm2/")
3433 (synopsis "Logical volume management for Linux")
3434 (description
3435 "LVM2 is the logical volume management tool set for Linux-based systems.
3436 This package includes the user-space libraries and tools, including the device
3437 mapper. Kernel components are part of Linux-libre.")
3438
3439 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
3440 ;; Command-line tools are GPLv2.
3441 (license (list license:gpl2 license:lgpl2.1))))
3442
3443 (define-public lvm2-static
3444 (package
3445 (inherit lvm2)
3446 (name "lvm2-static")
3447
3448 ;; Propagate udev because libdevmapper.a depends on libudev.
3449 (propagated-inputs `(("udev:static" ,eudev "static")))
3450
3451 (arguments
3452 (substitute-keyword-arguments (package-arguments lvm2)
3453 ((#:configure-flags flags '())
3454 ;; LVM2 doesn't use Libtool, hence the custom option.
3455 `(append '("--enable-static_link")
3456 ;; Building dmeventd statically is complicated due to a
3457 ;; requirement on libdevmapper.a, which is being phased out
3458 ;; in favor of libdevice-mapper.a, which in turn is is not
3459 ;; easily made available at dmeventd build time. Just ignore
3460 ;; it until the situation improves.
3461 (delete "--enable-dmeventd" ,flags)))
3462 ((#:phases phases)
3463 `(modify-phases ,phases
3464 (add-before 'configure 'adjust-Makefile
3465 (lambda _
3466 ;; These fixes are related to the upstream libdm->device_mapper
3467 ;; migration and will hopefully be fixed upstream in due time.
3468 (substitute* "tools/Makefile.in"
3469 ;; This variable is empty in a static configuration and causes
3470 ;; an erroneous GCC command line.
3471 (("-L\\$\\(interfacebuilddir\\)") "")
3472 ;; Remove obsolete reference to libdevmapper.a.
3473 (("-ldevmapper") ""))
3474 #t))))))
3475 (synopsis "Logical volume management for Linux (statically linked)")))
3476
3477 (define-public thin-provisioning-tools
3478 (package
3479 (name "thin-provisioning-tools")
3480 (version "0.8.5")
3481 (source
3482 (origin
3483 (method git-fetch)
3484 (uri (git-reference
3485 (url "https://github.com/jthornber/thin-provisioning-tools")
3486 (commit (string-append "v" version))))
3487 (file-name (git-file-name name version))
3488 (sha256
3489 (base32 "01wl8c0cjbx1smbhj8dx6av5bnw5775m58gasc3vqwvsj0s9hq19"))))
3490 (build-system gnu-build-system)
3491 (arguments
3492 ;; Doesn't build with --enable-testing due to a function name collision
3493 ;; with glibc. Fixed upstream. TODO: Enable tests when 0.9.0 is released.
3494 `(#:tests? #f))
3495 (native-inputs
3496 `(("automake" ,automake)
3497 ("autoreconf" ,autoconf)))
3498 (inputs
3499 `(("boost" ,boost)
3500 ("expat" ,expat)
3501 ("libaio" ,libaio)))
3502 (synopsis "Tools for manipulating the metadata of device-mapper targets")
3503 (description "A suite of tools for manipulating the metadata of the
3504 dm-thin, dm-cache and dm-era device-mapper targets.")
3505 (home-page "https://github.com/jthornber/thin-provisioning-tools")
3506 (license license:gpl3+)))
3507
3508 (define-public wireless-tools
3509 (package
3510 (name "wireless-tools")
3511 (version "30.pre9")
3512 (source (origin
3513 (method url-fetch)
3514 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools."
3515 version ".tar.gz"))
3516 (sha256
3517 (base32
3518 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
3519 (snippet
3520 '(begin
3521 ;; Remove the older header files that are not free software.
3522 (for-each (lambda (n)
3523 (delete-file (format #f "wireless.~a.h" n)))
3524 '(10 11 12 13 14 15 16 17 18 19 20))
3525 #t))))
3526 (build-system gnu-build-system)
3527 (arguments
3528 `(#:make-flags
3529 (list (string-append "PREFIX=" %output)
3530 (string-append "INSTALL_MAN=" %output "/share/man")
3531 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib")
3532 "BUILD_STATIC=")
3533 #:phases
3534 (modify-phases %standard-phases
3535 (replace 'configure
3536 (lambda* (#:key target #:allow-other-keys)
3537 (when ,(%current-target-system)
3538 ;; Cross-compilation: use the cross tools.
3539 (substitute* (find-files "." "Makefile")
3540 (("CC = .*$")
3541 (string-append "CC = " target "-gcc\n"))
3542 (("AR = .*$")
3543 (string-append "AR = " target "-ar\n"))
3544 (("RANLIB = .*$")
3545 (string-append "RANLIB = " target "-ranlib\n"))))
3546 #t)))
3547 #:tests? #f))
3548 (synopsis "Tools for manipulating Linux Wireless Extensions")
3549 (description "Wireless Tools are used to manipulate the now-deprecated
3550 Linux Wireless Extensions; consider using @code{iw} instead. The Wireless
3551 Extension was an interface allowing you to set Wireless LAN specific
3552 parameters and get the specific stats. It is deprecated in favor the nl80211
3553 interface.")
3554 (home-page "https://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
3555 ;; wireless.21.h and wireless.22.h are distributed under lgpl2.1+, the
3556 ;; other files are distributed under gpl2.
3557 (license (list license:gpl2 license:lgpl2.1+))))
3558
3559 (define-public crda
3560 (package
3561 (name "crda")
3562 (version "3.18")
3563 (source (origin
3564 (method url-fetch)
3565 (uri (string-append "mirror://kernel.org/software/network/crda/"
3566 "crda-" version ".tar.xz"))
3567 (sha256
3568 (base32
3569 "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23"))
3570 (patches (search-patches "crda-optional-gcrypt.patch"))))
3571 (build-system gnu-build-system)
3572 (arguments
3573 `(#:phases (modify-phases %standard-phases
3574 (delete 'configure)
3575 (add-after 'unpack 'gzip-determinism
3576 (lambda _
3577 (substitute* "Makefile"
3578 (("gzip") "gzip --no-name"))
3579 #t))
3580 ,@(if (%current-target-system)
3581 '((add-after
3582 'unpack 'fix-pkg-config
3583 (lambda* (#:key target #:allow-other-keys)
3584 (substitute*
3585 "Makefile"
3586 (("pkg-config")
3587 (string-append target "-pkg-config")))
3588 #t)))
3589 '())
3590 (add-before
3591 'build 'no-werror-no-ldconfig
3592 (lambda _
3593 (substitute* "Makefile"
3594 (("-Werror") "")
3595 (("ldconfig") "true"))
3596 #t))
3597 (add-before
3598 'build 'set-regulator-db-file-name
3599 (lambda* (#:key native-inputs inputs #:allow-other-keys)
3600 ;; Tell CRDA where to find our database.
3601 (let ((regdb (assoc-ref (or native-inputs inputs)
3602 "wireless-regdb")))
3603 (substitute* "crda.c"
3604 (("\"/lib/crda/regulatory.bin\"")
3605 (string-append "\"" regdb
3606 "/lib/crda/regulatory.bin\"")))
3607 #t))))
3608 #:test-target "verify"
3609 #:make-flags (let ((out (assoc-ref %outputs "out"))
3610 (regdb (assoc-ref %build-inputs "wireless-regdb")))
3611 (list
3612 (string-append "CC=" ,(cc-for-target))
3613 "V=1"
3614
3615 ;; Disable signature-checking on 'regulatory.bin'.
3616 ;; The reason is that this simplifies maintenance
3617 ;; on our side (no need to manage a distro key
3618 ;; pair), and we can guarantee integrity of
3619 ;; 'regulatory.bin' by other means anyway, such as
3620 ;; 'guix gc --verify'. See
3621 ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
3622 ;; for a discssion.
3623 "USE_OPENSSL=0"
3624
3625 (string-append "PREFIX=" out)
3626 (string-append "SBINDIR=" out "/sbin/")
3627 (string-append "UDEV_RULE_DIR="
3628 out "/lib/udev/rules.d")
3629 (string-append "LDFLAGS=-Wl,-rpath="
3630 out "/lib -L.")
3631 (string-append "REG_BIN=" regdb
3632 "/lib/crda/regulatory.bin")
3633 "all_noverify"))))
3634 (native-inputs `(("pkg-config" ,pkg-config)
3635 ("wireless-regdb" ,wireless-regdb)))
3636 (inputs `(("libnl" ,libnl)))
3637 (home-page
3638 "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
3639 (synopsis "Central regulatory domain agent (CRDA) for WiFi")
3640 (description
3641 "The Central Regulatory Domain Agent (CRDA) acts as the udev helper for
3642 communication between the kernel Linux and user space for regulatory
3643 compliance.")
3644 (license license:copyleft-next)))
3645
3646 (define-public wireless-regdb
3647 (package
3648 (name "wireless-regdb")
3649 (version "2020.04.29")
3650 (source (origin
3651 (method url-fetch)
3652 (uri (string-append
3653 "mirror://kernel.org/software/network/wireless-regdb/"
3654 "wireless-regdb-" version ".tar.xz"))
3655 (sha256
3656 (base32
3657 "0yicda474ygahv8da18h1p4yf42s6x2f208mlwcw4xsrxld07zc9"))
3658
3659 ;; We're building 'regulatory.bin' by ourselves.
3660 (snippet '(begin
3661 (delete-file "regulatory.bin")
3662 #t))))
3663 (build-system gnu-build-system)
3664 (arguments
3665 '(#:phases
3666 (modify-phases %standard-phases
3667 (add-after 'unpack 'gzip-determinism
3668 (lambda _
3669 (substitute* "Makefile"
3670 (("gzip") "gzip --no-name"))
3671 #t))
3672 (add-after 'unpack 'omit-signature
3673 (lambda _
3674 (substitute* "Makefile"
3675 ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
3676 ;; don't provide (see below). Disable it.
3677 ((" regulatory\\.db\\.p7s") "")
3678 ;; regulatory.db is built as a dependency of regulatory.db.p7s,
3679 ;; but ‘make install’ depends only on the latter while installing
3680 ;; both (and failing). Depend on it explicitly.
3681 (("^install: " all) (string-append all "regulatory.db ")))
3682 #t))
3683 (delete 'configure)) ; no configure script
3684
3685 ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
3686 ;; is computed and can be equal to 'maintainer-clean'; when that
3687 ;; happens, we can end up deleting the 'regulatory.bin' file that we
3688 ;; just built. Thus, build things sequentially.
3689 #:parallel-build? #f
3690
3691 #:tests? #f ; no tests
3692 #:make-flags
3693 (let ((out (assoc-ref %outputs "out")))
3694 (list (string-append "PREFIX=" out)
3695 (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
3696
3697 ;; Leave this empty so that db2bin.py doesn't try to sign
3698 ;; ‘regulatory.bin’. This allows us to avoid managing a key
3699 ;; pair for the whole distribution.
3700 (string-append "REGDB_PRIVKEY=")
3701 ;; Don't generate a public key for the same reason. These are
3702 ;; used as Makefile targets and can't be the empty string.
3703 (string-append "REGDB_PUBCERT=/dev/null")
3704 (string-append "REGDB_PUBKEY=/dev/null")))))
3705 (native-inputs
3706 `(("python" ,python-wrapper)))
3707 (home-page
3708 "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
3709 (synopsis "Wireless regulatory database")
3710 (description
3711 "This package contains the wireless regulatory database Central
3712 Regulatory Database Agent (CRDA) daemon. The database contains information on
3713 country-specific regulations for the wireless spectrum.")
3714 (license license:isc)))
3715
3716 (define-public lm-sensors
3717 (package
3718 (name "lm-sensors")
3719 (version "3.6.0")
3720 (source
3721 (origin
3722 (method git-fetch)
3723 (uri (git-reference
3724 (url "https://github.com/groeck/lm-sensors")
3725 (commit (string-append "V" (string-join
3726 (string-split version #\.) "-")))))
3727 (file-name (git-file-name name version))
3728 (sha256
3729 (base32 "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn"))
3730 (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
3731 (build-system gnu-build-system)
3732 (inputs `(("rrdtool" ,rrdtool)
3733 ("perl" ,perl)
3734 ("kmod" ,kmod)
3735 ("gnuplot" ,gnuplot)))
3736 (native-inputs `(("pkg-config" ,pkg-config)
3737 ("flex" ,flex)
3738 ("bison" ,bison)
3739 ("which" ,which)))
3740 (outputs '("lib" ; avoid perl in closure
3741 "out"))
3742 (arguments
3743 `(#:tests? #f ; no 'check' target
3744 #:make-flags (list (string-append "PREFIX=" %output)
3745 (string-append "ETCDIR=" (assoc-ref %outputs "lib") "/etc")
3746 (string-append "INCLUDEDIR="
3747 (assoc-ref %outputs "lib") "/include")
3748 (string-append "MANDIR=" %output "/share/man")
3749 (string-append "LIBDIR=" (assoc-ref %outputs "lib") "/lib"))
3750 #:phases
3751 (modify-phases %standard-phases
3752 (delete 'configure)
3753 (add-before 'build 'patch-exec-paths
3754 (lambda* (#:key inputs outputs #:allow-other-keys)
3755 (substitute* "prog/detect/sensors-detect"
3756 (("`uname")
3757 (string-append "`" (assoc-ref inputs "coreutils")
3758 "/bin/uname"))
3759 (("(`|\")modprobe" all open-quote)
3760 (string-append open-quote
3761 (assoc-ref inputs "kmod")
3762 "/bin/modprobe")))
3763 (substitute* '("prog/pwm/pwmconfig"
3764 "prog/pwm/fancontrol")
3765 (("gnuplot")
3766 (string-append (assoc-ref inputs "gnuplot")
3767 "/bin/gnuplot"))
3768 (("cat ")
3769 (string-append (assoc-ref inputs "coreutils")
3770 "/bin/cat "))
3771 (("e?grep " match)
3772 (string-append (assoc-ref inputs "grep")
3773 "/bin/" match))
3774 (("sed -e")
3775 (string-append (assoc-ref inputs "sed")
3776 "/bin/sed -e"))
3777 (("cut -d")
3778 (string-append (assoc-ref inputs "coreutils")
3779 "/bin/cut -d"))
3780 (("sleep ")
3781 (string-append (assoc-ref inputs "coreutils")
3782 "/bin/sleep "))
3783 (("readlink -f")
3784 (string-append (assoc-ref inputs "coreutils")
3785 "/bin/readlink -f")))
3786 #t)))))
3787 (home-page "https://hwmon.wiki.kernel.org/lm_sensors")
3788 (synopsis "Utilities to read temperature/voltage/fan sensors")
3789 (description
3790 "Lm-sensors is a hardware health monitoring package for Linux. It allows
3791 you to access information from temperature, voltage, and fan speed sensors.
3792 It works with most newer systems.")
3793 (license license:gpl2+)))
3794
3795 (define-public iucode-tool
3796 (package
3797 (name "iucode-tool")
3798 (version "2.3.1")
3799 (source (origin
3800 (method url-fetch)
3801 (uri (string-append "https://gitlab.com/iucode-tool/releases"
3802 "/raw/latest/iucode-tool_" version ".tar.xz"))
3803 (sha256
3804 (base32
3805 "159gvf6ljgg3g4vlhyy6pyr0wz11rcyhp985vc4az58d9px8xf0j"))))
3806 (build-system gnu-build-system)
3807 (home-page "https://gitlab.com/iucode-tool/iucode-tool/wikis/home")
3808 (synopsis "Manipulate Intel microcode bundles")
3809 (description
3810 "@command{iucode_tool} is a utility to work with microcode packages for
3811 Intel processors. It can convert between formats, extract specific versions,
3812 create a firmware image suitable for the Linux kernel, and more.")
3813 ;; cpuid.h is available for i686, x86_64, and ia64.
3814 (supported-systems '("i686-linux" "x86_64-linux"))
3815 (license license:gpl2+)))
3816
3817 (define-public i2c-tools
3818 (package
3819 (name "i2c-tools")
3820 (version "3.1.1")
3821 (source (origin
3822 (method url-fetch)
3823 (uri (string-append
3824 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
3825 version ".tar.bz2"))
3826 (sha256
3827 (base32
3828 "000pvg995qy1b15ks59gd0klri55hb33kqpg5czy84hw1pbdgm0l"))))
3829 (build-system gnu-build-system)
3830 (arguments
3831 `(#:tests? #f ; no 'check' target
3832 #:make-flags (list (string-append "prefix=" %output)
3833 ,(string-append "CC=" (cc-for-target)))
3834 ;; No configure script.
3835 #:phases (modify-phases %standard-phases (delete 'configure))))
3836 (inputs
3837 `(("perl" ,perl)))
3838 (home-page "http://jdelvare.nerim.net/devel.html#i2ctools")
3839 (synopsis "I2C tools for Linux")
3840 (description
3841 "The i2c-tools package contains a heterogeneous set of I2C tools for
3842 Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
3843 EEPROM decoding scripts, EEPROM programming tools, and a python module for
3844 SMBus access.")
3845 (license license:gpl2+)))
3846
3847 (define-public xsensors
3848 (package
3849 (name "xsensors")
3850 (version "0.70")
3851 (source (origin
3852 (method url-fetch)
3853 (uri (string-append
3854 "http://www.linuxhardware.org/xsensors/xsensors-"
3855 version ".tar.gz"))
3856 (sha256
3857 (base32
3858 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
3859 (build-system gnu-build-system)
3860 (inputs `(("lm-sensors" ,lm-sensors "lib")
3861 ("gtk" ,gtk+-2)))
3862 (native-inputs `(("pkg-config" ,pkg-config)))
3863 (arguments
3864 `(#:phases
3865 (modify-phases %standard-phases
3866 (add-before 'configure 'enable-deprecated
3867 (lambda _
3868 (substitute* "src/Makefile.in"
3869 (("-DGDK_DISABLE_DEPRECATED") "")
3870 (("-DGTK_DISABLE_DEPRECATED") ""))
3871 #t))
3872 (add-before 'configure 'remove-Werror
3873 (lambda _
3874 (substitute* '("configure" "src/Makefile.in")
3875 (("-Werror") ""))
3876 #t)))))
3877 (home-page "http://www.linuxhardware.org/xsensors/")
3878 (synopsis "Hardware health information viewer")
3879 (description
3880 "Xsensors reads data from the libsensors library regarding hardware
3881 health such as temperature, voltage and fan speed and displays the information
3882 in a digital read-out.")
3883 (license license:gpl2+)))
3884
3885 (define-public perf
3886 (package
3887 (name "perf")
3888 (version (package-version linux-libre))
3889 (source (package-source linux-libre))
3890 (build-system gnu-build-system)
3891 (arguments
3892 '(#:phases
3893 (modify-phases %standard-phases
3894 (replace 'configure
3895 (lambda* (#:key inputs #:allow-other-keys)
3896 (setenv "SHELL_PATH" (which "bash"))
3897 (chdir "tools/perf")
3898 #t)))
3899 #:make-flags (list (string-append "prefix="
3900 (assoc-ref %outputs "out"))
3901 "CC=gcc"
3902 "WERROR=0"
3903
3904 ;; By default, 'config/Makefile' uses lib64 on
3905 ;; x86_64. Work around that.
3906 "lib=lib")
3907 #:tests? #f)) ;no tests
3908 (native-inputs
3909 `(("pkg-config" ,pkg-config)
3910 ("bison" ,bison)
3911 ("flex" ,flex)
3912
3913 ;; There are build scripts written in these languages.
3914 ("perl" ,perl)
3915 ("python2" ,python-2)
3916 ("python3" ,python-3)))
3917 (inputs
3918 `(("slang" ,slang) ;for the interactive TUI
3919 ;; ("newt" ,newt)
3920 ("python" ,python-2) ;'perf' links against libpython
3921 ("elfutils" ,elfutils)
3922 ("libiberty" ,libiberty) ;used alongside BDF for symbol demangling
3923 ("libunwind" ,libunwind) ;better stack walking
3924 ("numactl" ,numactl) ;for 'perf bench numa mem'
3925
3926 ;; Documentation.
3927 ("libxml2" ,libxml2) ;for $XML_CATALOG_FILES
3928 ("docbook-xsl" ,docbook-xsl)
3929 ("xmlto" ,xmlto)
3930 ("asciidoc" ,asciidoc)))
3931 (home-page "https://perf.wiki.kernel.org/")
3932 (synopsis "Linux profiling with performance counters")
3933 (description
3934 "perf is a tool suite for profiling using hardware performance counters,
3935 with support in the Linux kernel. perf can instrument CPU performance
3936 counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable
3937 of lightweight profiling. This package contains the user-land tools and in
3938 particular the @code{perf} command.")
3939 (license (package-license linux-libre))))
3940
3941 (define-public pflask
3942 (package
3943 (name "pflask")
3944 (version "0.2")
3945 (source (origin
3946 (method git-fetch)
3947 (uri (git-reference
3948 (url "https://github.com/ghedo/pflask")
3949 (commit (string-append "v" version))))
3950 (file-name (git-file-name name version))
3951 (sha256
3952 (base32
3953 "1jikjbhlxlqracnai3v9krzcgd2xwp0p4adw5n07yxc7b857damz"))))
3954 (build-system cmake-build-system)
3955 (arguments
3956 '(#:tests? #f)) ; no tests
3957 (home-page "https://ghedo.github.io/pflask/")
3958 (synopsis "Simple tool for creating Linux namespace containers")
3959 (description "pflask is a simple tool for creating Linux namespace
3960 containers. It can be used for running a command or even booting an OS inside
3961 an isolated container, created with the help of Linux namespaces. It is
3962 similar in functionality to chroot, although pflask provides better isolation
3963 thanks to the use of namespaces.")
3964 (license license:bsd-2)))
3965
3966 (define-public singularity
3967 (package
3968 (name "singularity")
3969 (version "2.6.1")
3970 (source (origin
3971 (method url-fetch)
3972 (uri (string-append "https://github.com/singularityware/singularity/"
3973 "releases/download/" version
3974 "/singularity-" version ".tar.gz"))
3975 (sha256
3976 (base32
3977 "1whx0hqqi1326scgdxxxa1d94vn95mnq0drid6s8wdp84ni4d3gk"))
3978 (modules '((guix build utils)))
3979 (snippet
3980 '(begin
3981 ;; Do not create directories in /var.
3982 (substitute* "Makefile.in"
3983 (("\\$\\(MAKE\\) .*install-data-hook") ""))
3984
3985 ;; The original source overrides PATH so that it points to
3986 ;; /bin, /usr/local/bin, etc., which obviously doesn't work
3987 ;; on Guix System. Leave PATH unchanged so we refer to the
3988 ;; installed Coreutils, grep, etc.
3989 (substitute* "bin/singularity.in"
3990 (("^PATH=.*" all)
3991 (string-append "#" all "\n")))
3992
3993 (substitute* (find-files "libexec/cli" "\\.exec$")
3994 (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
3995 _ program)
3996 (string-append "/run/setuid-programs/singularity-"
3997 program "-helper")))
3998
3999 ;; These squashfs mount options are apparently no longer
4000 ;; supported since Linux-libre 5.4.5.
4001 (substitute* "src/lib/image/squashfs/mount.c"
4002 (("\"errors=remount-ro\"")
4003 "NULL"))
4004 #t))))
4005 (build-system gnu-build-system)
4006 (arguments
4007 `(#:configure-flags '("--localstatedir=/var")
4008 #:phases
4009 (modify-phases %standard-phases
4010 (add-after 'unpack 'patch-references
4011 (lambda _
4012 (substitute* "libexec/cli/build.exec"
4013 (("if ! singularity_which mksquashfs") "if 0")
4014 (("if ! mksquashfs")
4015 (string-append "if ! " (which "mksquashfs"))))
4016 (substitute* (list "libexec/cli/help.exec"
4017 "libexec/bootstrap-scripts/functions"
4018 "libexec/bootstrap-scripts/post.sh"
4019 "libexec/functions")
4020 (("\\| grep ")
4021 (string-append "| " (which "grep") " "))
4022 (("egrep ")
4023 (string-append (which "egrep") " ")))
4024 #t))
4025 (add-after 'install 'set-PATH
4026 (lambda* (#:key inputs outputs #:allow-other-keys)
4027 ;; Have the 'singularity' and 'run-singularity' self-sufficient.
4028 (let ((out (assoc-ref outputs "out"))
4029 (coreutils (assoc-ref inputs "coreutils")))
4030 (wrap-program (string-append out "/bin/singularity")
4031 `("PATH" ":" = (,(string-append coreutils "/bin"))))
4032 (substitute* (string-append out "/bin/run-singularity")
4033 (("/usr/bin/env singularity")
4034 (string-append (which "env") " "
4035 out "/bin/singularity")))
4036 #t))))))
4037 (inputs
4038 `(("libarchive" ,libarchive)
4039 ("python" ,python-wrapper)
4040 ("zlib" ,zlib)
4041 ("squashfs-tools" ,squashfs-tools)))
4042 (home-page "https://singularity.lbl.gov/")
4043 (synopsis "Container platform")
4044 (description "Singularity is a container platform supporting a number of
4045 container image formats. It can build SquashFS container images or import
4046 existing Docker images. Singularity requires kernel support for container
4047 isolation or root privileges.")
4048 (license license:bsd-3)))
4049
4050 (define-public hdparm
4051 (package
4052 (name "hdparm")
4053 (version "9.58")
4054 (source (origin
4055 (method url-fetch)
4056 (uri (string-append "mirror://sourceforge/hdparm/hdparm/"
4057 "hdparm-" version ".tar.gz"))
4058 (sha256
4059 (base32
4060 "03z1qm8zbgpxagk3994lvp24yqsshjibkwg05v9p3q1w7y48xrws"))))
4061 (build-system gnu-build-system)
4062 (arguments
4063 `(#:make-flags
4064 (let ((out (assoc-ref %outputs "out")))
4065 (list (string-append "binprefix=" out)
4066 (string-append "manprefix=" out)
4067 ,(string-append "CC=" (cc-for-target))
4068 ;; Let Guix strip the binaries and not break cross-compilation.
4069 "STRIP=true"))
4070 #:phases
4071 (modify-phases %standard-phases
4072 (delete 'configure)) ; no configure script
4073 #:tests? #f)) ; no test suite
4074 (home-page "https://sourceforge.net/projects/hdparm/")
4075 (synopsis "View and tune ATA disk drive parameters")
4076 (description
4077 "@command{hdparm} is a command-line utility to control ATA controllers and
4078 disk drives. It can increase performance and/or reliability by careful tuning
4079 of hardware settings like power and acoustic management, DMA modes, and caching.
4080 It can also display detailed device information, or be used as a simple
4081 performance benchmarking tool.
4082
4083 @command{hdparm} provides a command line interface to various Linux kernel
4084 interfaces provided by the SATA/ATA/SAS @code{libata} subsystem, and the older
4085 IDE driver subsystem. Many external USB drive enclosures with SCSI-ATA Command
4086 Translation (@dfn{SAT}) are also supported.")
4087 (license (license:non-copyleft "file://LICENSE.TXT"))))
4088
4089 (define-public nvme-cli
4090 (package
4091 (name "nvme-cli")
4092 (version "1.12")
4093 (home-page "https://github.com/linux-nvme/nvme-cli")
4094 (source (origin
4095 (method git-fetch)
4096 (uri (git-reference
4097 (url home-page)
4098 (commit (string-append "v" version))))
4099 (sha256
4100 (base32 "0ldky34sn0m5c4hgiip0fkzm465nca69bhxicpd5dg8wxhzxqrp3"))
4101 (file-name (git-file-name name version))))
4102 (build-system gnu-build-system)
4103 (arguments
4104 `(#:make-flags
4105 (list ,(string-append "CC=" (cc-for-target)))
4106 #:phases (modify-phases %standard-phases
4107 (delete 'configure) ; no ./configure script
4108 (replace 'install
4109 (lambda _
4110 (invoke "make" "install-spec" "PREFIX="
4111 (string-append "DESTDIR=" %output)))))
4112 ;; The tests require sysfs, which is not accessible from from the build
4113 ;; environment
4114 #:tests? #f))
4115 (synopsis "NVM-Express user space tooling for Linux")
4116 (description "Nvme-cli is a utility to provide standards compliant tooling
4117 for NVM-Express drives. It was made specifically for Linux as it relies on the
4118 IOCTLs defined by the mainline kernel driver.")
4119 (license license:gpl2+)))
4120
4121 (define-public rfkill
4122 (package
4123 (name "rfkill")
4124 (version "0.5")
4125 (source (origin
4126 (method url-fetch)
4127 (uri (string-append "mirror://kernel.org/software/network/"
4128 name "/" name "-" version ".tar.xz"))
4129 (sha256
4130 (base32
4131 "0snqj5h0y991lszbigbyyqb8swj0hxajc1vfqg2scfay44231bp0"))))
4132 (build-system gnu-build-system)
4133 (arguments
4134 `(#:make-flags (list "CC=gcc"
4135 (string-append "PREFIX=" %output))
4136 #:phases (modify-phases %standard-phases
4137 (delete 'configure))
4138 #:tests? #f))
4139 (home-page "https://wireless.wiki.kernel.org/en/users/Documentation/rfkill")
4140 (synopsis "Tool for enabling and disabling wireless devices")
4141 (description
4142 "rfkill is a simple tool for accessing the rfkill device interface,
4143 which is used to enable and disable wireless networking devices, typically
4144 WLAN, Bluetooth and mobile broadband.")
4145 (license (license:non-copyleft "file://COPYING"
4146 "See COPYING in the distribution."))
4147 ;; rfkill is part of util-linux as of 2.31.
4148 (properties `((superseded . ,util-linux)))))
4149
4150 (define-public acpi
4151 (package
4152 (name "acpi")
4153 (version "1.7")
4154 (source (origin
4155 (method url-fetch)
4156 (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/"
4157 version "/" name "-" version ".tar.gz"))
4158 (sha256
4159 (base32
4160 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
4161 (build-system gnu-build-system)
4162 (home-page "http://acpiclient.sourceforge.net")
4163 (synopsis "Display information on ACPI devices")
4164 (description "@code{acpi} attempts to replicate the functionality of the
4165 \"old\" @code{apm} command on ACPI systems, including battery and thermal
4166 information. It does not support ACPI suspending, only displays information
4167 about ACPI devices.")
4168 (license license:gpl2+)))
4169
4170 (define-public acpid
4171 (package
4172 (name "acpid")
4173 (version "2.0.32")
4174 (source (origin
4175 (method url-fetch)
4176 (uri (string-append "mirror://sourceforge/acpid2/acpid-"
4177 version ".tar.xz"))
4178 (sha256
4179 (base32
4180 "0zhmxnhnhg4v1viw82yjr22kram6k5k1ixznhayk8cnw7q5x7lpj"))))
4181 (build-system gnu-build-system)
4182 (home-page "https://sourceforge.net/projects/acpid2/")
4183 (synopsis "Daemon for delivering ACPI events to user-space programs")
4184 (description
4185 "acpid is designed to notify user-space programs of Advanced
4186 Configuration and Power Interface (ACPI) events. acpid should be started
4187 during the system boot, and will run as a background process. When an ACPI
4188 event is received from the kernel, acpid will examine the list of rules
4189 specified in /etc/acpi/events and execute the rules that match the event.")
4190 (license license:gpl2+)))
4191
4192 (define-public sysfsutils
4193 (package
4194 (name "sysfsutils")
4195 (version "2.1.0")
4196 (source
4197 (origin
4198 (method url-fetch)
4199 (uri
4200 (string-append
4201 "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
4202 version ".tar.gz"))
4203 (sha256
4204 (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
4205 (build-system gnu-build-system)
4206 (home-page "http://linux-diag.sourceforge.net/Sysfsutils.html")
4207 (synopsis "System utilities based on Linux sysfs")
4208 (description
4209 "These are a set of utilities built upon sysfs, a virtual file system in
4210 Linux kernel versions 2.5+ that exposes a system's device tree. The package
4211 also contains the libsysfs library.")
4212 ;; The library is under lgpl2.1+ (all files say "or any later version").
4213 ;; The rest is mostly gpl2, with a few files indicating gpl2+.
4214 (license (list license:gpl2 license:gpl2+ license:lgpl2.1+))))
4215
4216 (define-public sysfsutils-1
4217 (package
4218 (inherit sysfsutils)
4219 (version "1.3.0")
4220 (source
4221 (origin
4222 (method url-fetch)
4223 (uri
4224 (string-append
4225 "mirror://sourceforge/linux-diag/sysfsutils/sysfsutils-" version
4226 "/sysfsutils-" version ".tar.gz"))
4227 (sha256
4228 (base32 "0kdhs07fm8263pxwd5blwn2x211cg4fk63fyf9ijcdkvzmwxrqq3"))
4229 (modules '((guix build utils)))
4230 (snippet
4231 '(begin
4232 (substitute* "Makefile.in"
4233 (("includedir = /usr/include/sysfs")
4234 "includedir = @includedir@"))
4235 (substitute* "configure"
4236 (("includedir='(\\$\\{prefix\\}/include)'" all orig)
4237 (string-append "includedir='" orig "/sysfs'")))
4238 #t))))
4239 (synopsis "System utilities based on Linux sysfs (version 1.x)")))
4240
4241 (define-public cpufrequtils
4242 (package
4243 (name "cpufrequtils")
4244 (version "0.3")
4245 (source
4246 (origin
4247 (method url-fetch)
4248 (uri (string-append "mirror://kernel.org/linux/utils/kernel/cpufreq/"
4249 "cpufrequtils-" version ".tar.gz"))
4250 (sha256
4251 (base32 "0qfqv7nqmjfr3p0bwrdlxkiqwqr7vmx053cadaa548ybqbghxmvm"))
4252 (patches (search-patches "cpufrequtils-fix-aclocal.patch"))))
4253 (build-system gnu-build-system)
4254 (native-inputs
4255 `(("sysfsutils" ,sysfsutils-1)))
4256 (arguments
4257 '(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
4258 (assoc-ref %outputs "out") "/lib"))))
4259 (home-page "https://www.kernel.org/pub/linux/utils/kernel/cpufreq/")
4260 (synopsis "Utilities to get and set CPU frequency on Linux")
4261 (description
4262 "The cpufrequtils suite contains utilities to retrieve CPU frequency
4263 information, and set the CPU frequency if supported, using the cpufreq
4264 capabilities of the Linux kernel.")
4265 (license license:gpl2)))
4266
4267 (define-public libraw1394
4268 (package
4269 (name "libraw1394")
4270 (version "2.1.2")
4271 (source (origin
4272 (method url-fetch)
4273 (uri (string-append
4274 "mirror://kernel.org/linux/libs/ieee1394/"
4275 name "-" version ".tar.xz"))
4276 (sha256
4277 (base32
4278 "0pm5b415j1qdzyw38wdv8h7ff4yx20831z1727mpsb6jc6bwdk03"))))
4279 (build-system gnu-build-system)
4280 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
4281 (synopsis "Interface library for the Linux IEEE1394 drivers")
4282 (description
4283 "Libraw1394 is the only supported interface to the kernel side raw1394 of
4284 the Linux IEEE-1394 subsystem, which provides direct access to the connected
4285 1394 buses to user space. Through libraw1394/raw1394, applications can directly
4286 send to and receive from other nodes without requiring a kernel driver for the
4287 protocol in question.")
4288 (license license:lgpl2.1+)))
4289
4290 (define-public libavc1394
4291 (package
4292 (name "libavc1394")
4293 (version "0.5.4")
4294 (source (origin
4295 (method url-fetch)
4296 (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
4297 name "-" version ".tar.gz"))
4298 (sha256
4299 (base32
4300 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
4301 (build-system gnu-build-system)
4302 (native-inputs
4303 `(("pkg-config" ,pkg-config)))
4304 (propagated-inputs
4305 `(("libraw1394" ,libraw1394))) ; required by libavc1394.pc
4306 (home-page "https://sourceforge.net/projects/libavc1394/")
4307 (synopsis "AV/C protocol library for IEEE 1394")
4308 (description
4309 "Libavc1394 is a programming interface to the AV/C specification from
4310 the 1394 Trade Association. AV/C stands for Audio/Video Control.")
4311 (license license:lgpl2.1+)))
4312
4313 (define-public libiec61883
4314 (package
4315 (name "libiec61883")
4316 (version "1.2.0")
4317 (source (origin
4318 (method url-fetch)
4319 (uri (string-append
4320 "mirror://kernel.org/linux/libs/ieee1394/"
4321 name "-" version ".tar.xz"))
4322 (sha256
4323 (base32
4324 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
4325 (build-system gnu-build-system)
4326 (native-inputs
4327 `(("pkg-config" ,pkg-config)))
4328 (propagated-inputs
4329 `(("libraw1394" ,libraw1394))) ; required by libiec61883.pc
4330 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
4331 (synopsis "Isochronous streaming media library for IEEE 1394")
4332 (description
4333 "The libiec61883 library provides a higher level API for streaming DV,
4334 MPEG-2 and audio over Linux IEEE 1394.")
4335 (license license:lgpl2.1+)))
4336
4337 (define-public mdadm
4338 (package
4339 (name "mdadm")
4340 (version "4.1")
4341 (source (origin
4342 (method url-fetch)
4343 (uri (string-append
4344 "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
4345 version ".tar.xz"))
4346 (sha256
4347 (base32
4348 "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb"))))
4349 (build-system gnu-build-system)
4350 (inputs
4351 `(("udev" ,eudev)))
4352 (arguments
4353 `(#:make-flags (let ((out (assoc-ref %outputs "out")))
4354 (list ,(string-append "CC=" (cc-for-target))
4355 "INSTALL=install"
4356 "CHECK_RUN_DIR=0"
4357 ;; TODO: tell it where to find 'sendmail'
4358 ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
4359 (string-append "BINDIR=" out "/sbin")
4360 (string-append "MANDIR=" out "/share/man")
4361 (string-append "UDEVDIR=" out "/lib/udev")))
4362 #:phases
4363 (modify-phases %standard-phases
4364 (add-before 'build 'patch-program-paths
4365 (lambda* (#:key native-inputs inputs #:allow-other-keys)
4366 (let ((coreutils (assoc-ref (or native-inputs inputs)
4367 "coreutils")))
4368 (substitute* "udev-md-raid-arrays.rules"
4369 (("/usr/bin/(readlink|basename)" all program)
4370 (string-append coreutils "/bin/" program))))
4371 #t))
4372 (add-before 'build 'remove-W-error
4373 (lambda _
4374 ;; We cannot build with -Werror on i686 due to a
4375 ;; 'sign-compare' warning in util.c.
4376 (substitute* "Makefile"
4377 (("-Werror") ""))
4378 #t))
4379 (delete 'configure))
4380 ;;tests must be done as root
4381 #:tests? #f))
4382 (supported-systems (delete "i586-gnu" %supported-systems))
4383 (home-page "http://neil.brown.name/blog/mdadm")
4384 (synopsis "Tool for managing Linux Software RAID arrays")
4385 (description
4386 "mdadm is a tool for managing Linux Software RAID arrays. It can create,
4387 assemble, report on, and monitor arrays. It can also move spares between raid
4388 arrays when needed.")
4389 (license license:gpl2+)))
4390
4391 (define-public mdadm-static
4392 (package
4393 (inherit mdadm)
4394 (name "mdadm-static")
4395 (arguments
4396 (substitute-keyword-arguments (package-arguments mdadm)
4397 ((#:make-flags flags)
4398 `(cons "LDFLAGS = -static" ,flags))
4399 ((#:phases phases)
4400 `(modify-phases ,phases
4401 (add-after 'install 'remove-cruft
4402 (lambda* (#:key outputs #:allow-other-keys)
4403 (let* ((out (assoc-ref outputs "out"))
4404 (precious? (lambda (file)
4405 (member file '("." ".." "sbin"))))
4406 (directories (scandir out (negate precious?))))
4407 (with-directory-excursion out
4408 (for-each delete-file-recursively directories)
4409 (remove-store-references "sbin/mdadm")
4410 (delete-file "sbin/mdmon")
4411 #t))))))
4412 ((#:modules modules %gnu-build-system-modules)
4413 `((ice-9 ftw) ,@modules))
4414 ((#:strip-flags _ '())
4415 ''("--strip-all")) ;strip a few extra KiB
4416 ((#:allowed-references _ '("out"))
4417 '("out")))) ;refer only self
4418 (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
4419
4420 (define-public multipath-tools
4421 (package
4422 (name "multipath-tools")
4423 (version "0.8.4")
4424 (source (origin
4425 (method git-fetch)
4426 (uri (git-reference
4427 (url "https://git.opensvc.com/multipath-tools/.git")
4428 (commit version)))
4429 (file-name (git-file-name name version))
4430 (sha256
4431 (base32
4432 "14n8pcgnliicqxzc40xvjxk4cafm4qx7a3rsx5qva74r3ydzx8rn"))
4433 (patches (search-patches "multipath-tools-sans-systemd.patch"))
4434 (modules '((guix build utils)))
4435 (snippet
4436 '(begin
4437 ;; Drop bundled valgrind headers.
4438 (delete-file-recursively "third-party")
4439 (substitute* '("multipathd/main.c"
4440 "libmultipath/debug.c")
4441 (("#include \"../third-party/")
4442 "#include \""))
4443 #t))))
4444 (build-system gnu-build-system)
4445 (arguments
4446 '(#:test-target "test"
4447 #:parallel-build? #f ;XXX: broken in 0.8.4
4448 #:make-flags (list "CC=gcc"
4449 (string-append "DESTDIR="
4450 (assoc-ref %outputs "out"))
4451 ;; Install Udev rules below this directory, relative
4452 ;; to the prefix.
4453 "SYSTEMDPATH=lib"
4454 (string-append "LDFLAGS=-Wl,-rpath="
4455 (assoc-ref %outputs "out")
4456 "/lib"))
4457 #:phases
4458 (modify-phases %standard-phases
4459 (add-after 'unpack 'patch-source
4460 (lambda* (#:key inputs #:allow-other-keys)
4461 (let ((lvm2 (assoc-ref inputs "lvm2"))
4462 (udev (assoc-ref inputs "udev")))
4463 (substitute* "Makefile.inc"
4464 (("\\$\\(prefix\\)/usr") "$(prefix)")
4465 ;; Do not save timestamp to avoid gzip "timestamp
4466 ;; out-of-range" warnings.
4467 (("gzip -9") "gzip -9n"))
4468 (substitute* '("kpartx/Makefile" "libmultipath/Makefile")
4469 (("/usr/include/libdevmapper.h")
4470 (string-append lvm2 "/include/libdevmapper.h"))
4471 (("/usr/include/libudev.h")
4472 (string-append udev "/include/libudev.h")))
4473 #t)))
4474 (add-after 'unpack 'fix-maybe-uninitialized-variable
4475 (lambda _
4476 ;; This variable gets initialized later if needed, but GCC 7
4477 ;; fails to notice. Should be fixed for > 0.8.4.
4478 ;; https://www.redhat.com/archives/dm-devel/2020-March/msg00137.html
4479 (substitute* "libmultipath/structs_vec.c"
4480 (("bool is_queueing;")
4481 "bool is_queueing = false;"))
4482 #t))
4483 (add-after 'unpack 'fix-linking-tests
4484 (lambda _
4485 ;; Add missing linker flag for -lmpathcmd. This should be fixed
4486 ;; for versions > 0.8.4.
4487 (substitute* "tests/Makefile"
4488 (("-lmultipath -lcmocka")
4489 "-lmultipath -L$(mpathcmddir) -lmpathcmd -lcmocka"))
4490 #t))
4491 (delete 'configure)))) ; no configure script
4492 (native-inputs
4493 `(("perl" ,perl)
4494 ("pkg-config" ,pkg-config)
4495 ("valgrind" ,valgrind)
4496
4497 ;; For tests.
4498 ("cmocka" ,cmocka)))
4499 (inputs
4500 `(("json-c" ,json-c-0.13)
4501 ("libaio" ,libaio)
4502 ("liburcu" ,liburcu)
4503 ("lvm2" ,lvm2)
4504 ("readline" ,readline)
4505 ("udev" ,eudev)))
4506 (home-page "http://christophe.varoqui.free.fr/")
4507 (synopsis "Access block devices through multiple paths")
4508 (description
4509 "This package provides the following binaries to drive the
4510 Linux Device Mapper multipathing driver:
4511 @enumerate
4512 @item @command{multipath} - Device mapper target autoconfig.
4513 @item @command{multipathd} - Multipath daemon.
4514 @item @command{mpathpersist} - Manages SCSI persistent reservations on
4515 @code{dm} multipath devices.
4516 @item @command{kpartx} - Create device maps from partition tables.
4517 @end enumerate")
4518 (license (list license:gpl2+ ; main distribution
4519 license:lgpl2.0+)))) ; libmpathcmd/mpath_cmd.h
4520
4521 (define-public libaio
4522 (package
4523 (name "libaio")
4524 (version "0.3.112")
4525 (source (origin
4526 (method url-fetch)
4527 (uri (list
4528 (string-append "https://releases.pagure.org/libaio/"
4529 name "-" version ".tar.gz")))
4530 (sha256
4531 (base32
4532 "14mlqdapjqq1dhpkdgy5z83mvsaz36fcxca7a4z6hinmr7r6415b"))))
4533 (build-system gnu-build-system)
4534 (arguments
4535 `(#:make-flags
4536 (let ((target ,(%current-target-system)))
4537 (list (string-append "prefix=" %output)
4538 (string-append
4539 "CC=" (if target
4540 (string-append (assoc-ref %build-inputs "cross-gcc")
4541 "/bin/" target "-gcc")
4542 "gcc"))))
4543 #:test-target "partcheck" ; need root for a full 'check'
4544 #:phases
4545 (modify-phases %standard-phases (delete 'configure)))) ; no configure script
4546 (home-page "https://pagure.io/libaio")
4547 (synopsis "Linux-native asynchronous I/O access library")
4548 (description
4549 "This library enables userspace to use Linux kernel asynchronous I/O
4550 system calls, important for the performance of databases and other advanced
4551 applications.")
4552 (license license:lgpl2.1+)))
4553
4554 (define-public blktrace
4555 ;; Take a newer commit to get the fix for CVE-2018-10689.
4556 (let ((commit "db4f6340e04716285ea56fe26d76381c3adabe58")
4557 (revision "1"))
4558 (package
4559 (name "blktrace")
4560 (version (git-version "1.2.0" revision commit))
4561 (home-page
4562 "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
4563 (source (origin
4564 (method git-fetch)
4565 (uri (git-reference
4566 (url home-page)
4567 (commit commit)))
4568 (sha256
4569 (base32 "0ah7xn4qnx09k6bm39p69av7d0c8cl6863drv6a1nf914sq1kpgp"))
4570 (file-name (git-file-name name version))))
4571 (build-system gnu-build-system)
4572 (arguments
4573 `(#:make-flags
4574 (list ,(string-append "CC=" (cc-for-target))
4575 (string-append "prefix=" %output))
4576 #:tests? #f ; no tests
4577 #:phases
4578 (modify-phases %standard-phases
4579 (delete 'configure) ; no configure script
4580 (add-after 'unpack 'fix-gnuplot-path
4581 (lambda* (#:key inputs #:allow-other-keys)
4582 (let ((gnuplot (assoc-ref inputs "gnuplot")))
4583 (substitute* "btt/bno_plot.py"
4584 (("gnuplot %s")
4585 (string-append gnuplot "/bin/gnuplot %s")))
4586 #t))))))
4587 (inputs
4588 `(("libaio" ,libaio)
4589 ("gnuplot" ,gnuplot)
4590 ("python" ,python-wrapper))) ;for 'bno_plot.py'
4591 (synopsis "Block layer IO tracing mechanism")
4592 (description "Blktrace is a block layer IO tracing mechanism which provides
4593 detailed information about request queue operations to user space. It extracts
4594 event traces from the kernel (via the relaying through the debug file system).")
4595 (license license:gpl2))))
4596
4597 (define-public sbc
4598 (package
4599 (name "sbc")
4600 (version "1.4")
4601 (source (origin
4602 (method url-fetch)
4603 (uri (string-append "mirror://kernel.org/linux/bluetooth/sbc-"
4604 version ".tar.xz"))
4605 (sha256
4606 (base32
4607 "1jal98pnrjkzxlkiqy0ykh4qmgnydz9bmsp1jn581p5kddpg92si"))))
4608 (build-system gnu-build-system)
4609 (inputs
4610 `(("libsndfile" ,libsndfile)))
4611 (native-inputs
4612 `(("pkg-config" ,pkg-config)))
4613 (home-page "https://www.kernel.org/pub/linux/bluetooth/")
4614 (synopsis "Bluetooth subband audio codec")
4615 (description
4616 "The SBC is a digital audio encoder and decoder used to transfer data to
4617 Bluetooth audio output devices like headphones or loudspeakers.")
4618 (license license:gpl2+)))
4619
4620 (define-public bluez
4621 (package
4622 (name "bluez")
4623 (version "5.54")
4624 (source (origin
4625 (method url-fetch)
4626 (uri (string-append
4627 "mirror://kernel.org/linux/bluetooth/bluez-"
4628 version ".tar.xz"))
4629 (sha256
4630 (base32
4631 "1p2ncvjz6alr9n3l5wvq2arqgc7xjs6dqyar1l9jp0z8cfgapkb8"))))
4632 (build-system gnu-build-system)
4633 (arguments
4634 `(#:configure-flags
4635 (let ((out (assoc-ref %outputs "out")))
4636 (list "--sysconfdir=/etc"
4637 "--localstatedir=/var"
4638 "--enable-library"
4639 "--disable-systemd"
4640 ;; Install dbus/udev files to the correct location.
4641 (string-append "--with-dbusconfdir=" out "/etc")
4642 (string-append "--with-udevdir=" out "/lib/udev")))
4643 #:phases
4644 (modify-phases %standard-phases
4645 ;; Test unit/test-gatt fails unpredictably. Seems to be a timing
4646 ;; issue (discussion on upstream mailing list:
4647 ;; https://marc.info/?t=149578476300002&r=1&w=2)
4648 (add-before 'check 'skip-wonky-test
4649 (lambda _
4650 (substitute* "unit/test-gatt.c"
4651 (("tester_init\\(&argc, &argv\\);") "return 77;"))
4652 #t))
4653 (add-after 'install 'post-install
4654 (lambda* (#:key inputs outputs #:allow-other-keys)
4655 (let* ((out (assoc-ref outputs "out"))
4656 (servicedir (string-append out "/share/dbus-1/services"))
4657 (service "obexd/src/org.bluez.obex.service")
4658 (rule (string-append
4659 out "/lib/udev/rules.d/97-hid2hci.rules")))
4660 ;; Install the obex dbus service file.
4661 (substitute* service
4662 (("/bin/false")
4663 (string-append out "/libexec/bluetooth/obexd")))
4664 (install-file service servicedir)
4665 ;; Fix paths in the udev rule.
4666 (substitute* rule
4667 (("hid2hci --method")
4668 (string-append out "/lib/udev/hid2hci --method"))
4669 (("/sbin/udevadm")
4670 (string-append (assoc-ref inputs "eudev") "/bin/udevadm")))
4671 #t))))))
4672 (native-inputs
4673 `(("pkg-config" ,pkg-config)
4674 ("gettext" ,gettext-minimal)))
4675 (inputs
4676 `(("glib" ,glib)
4677 ("dbus" ,dbus)
4678 ("eudev" ,eudev)
4679 ("libical" ,libical)
4680 ("readline" ,readline)))
4681 (home-page "http://www.bluez.org/")
4682 (synopsis "Linux Bluetooth protocol stack")
4683 (description
4684 "BlueZ provides support for the core Bluetooth layers and protocols. It
4685 is flexible, efficient and uses a modular implementation.")
4686 (license license:gpl2+)))
4687
4688 (define-public fuse-exfat
4689 (package
4690 (name "fuse-exfat")
4691 (version "1.3.0")
4692 (source (origin
4693 (method url-fetch)
4694 (uri (string-append
4695 "https://github.com/relan/exfat/releases/download/v"
4696 version "/" name "-" version ".tar.gz"))
4697 (sha256
4698 (base32
4699 "1lz00q8g4590mrdqmf13ba1s9zrqq645ymgm5p9y99ad0qv22r87"))))
4700 (build-system gnu-build-system)
4701 (native-inputs
4702 `(("pkg-config" ,pkg-config)))
4703 (inputs
4704 `(("fuse" ,fuse)))
4705 (home-page "https://github.com/relan/exfat")
4706 (synopsis "Mount exFAT file systems")
4707 (description
4708 "This package provides a FUSE-based file system that provides read and
4709 write access to exFAT devices.")
4710 (license license:gpl2+)))
4711
4712 (define-public fuseiso
4713 (package
4714 (name "fuseiso")
4715 (version "20070708")
4716 (source (origin
4717 (method url-fetch)
4718 (uri (string-append "mirror://sourceforge/fuseiso/fuseiso/"
4719 version "/fuseiso-" version ".tar.bz2"))
4720 (sha256
4721 (base32
4722 "127xql52dcdhmh7s5m9xc6q39jdlj3zhbjar1j821kb6gl3jw94b"))))
4723 (build-system gnu-build-system)
4724 (native-inputs
4725 `(("pkg-config" ,pkg-config)))
4726 (inputs
4727 `(("fuse" ,fuse)
4728 ("glib" ,glib)
4729 ("zlib" ,zlib)))
4730 (home-page "https://sourceforge.net/projects/fuseiso/")
4731 (synopsis "Mount ISO file system images")
4732 (description
4733 "FuseISO is a FUSE module to mount ISO file system images (.iso, .nrg,
4734 .bin, .mdf and .img files). It supports plain ISO9660 Level 1 and 2, Rock
4735 Ridge, Joliet, and zisofs.")
4736 (license license:gpl2)))
4737
4738 (define-public gpm
4739 (package
4740 (name "gpm")
4741 (version "1.20.7")
4742 (source (origin
4743 (method url-fetch)
4744 (uri (string-append
4745 "https://www.nico.schottelius.org/software/gpm/archives/"
4746 "gpm-" version ".tar.bz2"))
4747 (patches (search-patches "gpm-glibc-2.26.patch"))
4748 (sha256
4749 (base32
4750 "13d426a8h403ckpc8zyf7s2p5rql0lqbg2bv0454x0pvgbfbf4gh"))))
4751 (build-system gnu-build-system)
4752 (arguments
4753 '(#:phases (modify-phases %standard-phases
4754 (replace 'bootstrap
4755 (lambda _
4756 ;; The tarball was not generated with 'make dist' so we
4757 ;; need to bootstrap things ourselves.
4758 (substitute* "autogen.sh"
4759 (("/bin/sh") (which "sh")))
4760 (invoke "./autogen.sh")
4761 (patch-makefile-SHELL "Makefile.include.in")
4762 #t)))
4763
4764 ;; Make sure programs find libgpm.so.
4765 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
4766 (assoc-ref %outputs "out")
4767 "/lib"))))
4768 (native-inputs
4769 `(("texinfo" ,texinfo)
4770 ("bison" ,bison)
4771 ("flex" ,flex)
4772 ("autoconf" ,autoconf)
4773 ("automake" ,automake)
4774 ("libtool" ,libtool)))
4775 (home-page "https://www.nico.schottelius.org/software/gpm/")
4776 (synopsis "Mouse support for the Linux console")
4777 (description
4778 "The GPM (general-purpose mouse) daemon is a mouse server for
4779 applications running on the Linux console. It allows users to select items
4780 and copy/paste text in the console and in xterm.")
4781 (license license:gpl2+)))
4782
4783 (define-public btrfs-progs
4784 (package
4785 (name "btrfs-progs")
4786 (version "5.7")
4787 (source (origin
4788 (method url-fetch)
4789 (uri (string-append "mirror://kernel.org/linux/kernel/"
4790 "people/kdave/btrfs-progs/"
4791 "btrfs-progs-v" version ".tar.xz"))
4792 (sha256
4793 (base32
4794 "0p6ycbr8sw5bq3mj84gh9rvh5sk8sjr2l9hb9dhm4j41ij5h8bsw"))))
4795 (build-system gnu-build-system)
4796 (outputs '("out"
4797 "static")) ; static versions of the binaries in "out"
4798 (arguments
4799 '(#:phases (modify-phases %standard-phases
4800 (add-after 'unpack 'patch-makefile
4801 (lambda* (#:key outputs #:allow-other-keys)
4802 (substitute* "Makefile"
4803 (("\\$\\(DESTDIR\\)\\$\\(udevruledir\\)")
4804 (string-append (assoc-ref outputs "out")
4805 "/lib/udev/rules.d")))
4806 #t))
4807 (add-after 'build 'build-static
4808 (lambda _ (invoke "make" "static")))
4809 (add-after 'install 'install-bash-completion
4810 (lambda* (#:key outputs #:allow-other-keys)
4811 (let* ((out (assoc-ref outputs "out"))
4812 (bashcomp (string-append out "/etc/bash_completion.d")))
4813 (mkdir-p bashcomp)
4814 (copy-file "btrfs-completion"
4815 (string-append bashcomp "/btrfs"))
4816 #t)))
4817 (add-after 'install 'install-static
4818 (let ((staticbin (string-append (assoc-ref %outputs "static")
4819 "/bin")))
4820 (lambda _
4821 (invoke "make"
4822 (string-append "bindir=" staticbin)
4823 "install-static")))))
4824 #:tests? #f ; XXX: require the 'btrfs' kernel module.
4825 #:test-target "test"
4826 #:parallel-tests? #f)) ; tests fail when run in parallel
4827 (inputs `(("e2fsprogs" ,e2fsprogs) ; for btrfs-convert
4828 ("lzo" ,lzo)
4829 ("util-linux:lib" ,util-linux "lib") ;for libblkid and libuuid
4830 ("util-linux:static" ,util-linux "static") ;ditto
4831 ("zlib" ,zlib)
4832 ("zlib:static" ,zlib "static")
4833 ("zstd" ,zstd "lib")
4834 ("zstd:static" ,zstd "static")))
4835 (native-inputs `(("pkg-config" ,pkg-config)
4836 ("asciidoc" ,asciidoc)
4837 ("python" ,python)
4838 ("xmlto" ,xmlto)
4839 ;; For building documentation.
4840 ("libxml2" ,libxml2)
4841 ("docbook-xsl" ,docbook-xsl)
4842 ;; For tests.
4843 ("acl" ,acl)
4844 ("which" ,which)
4845 ("dmsetup" ,lvm2)
4846 ("udevadm" ,eudev)
4847 ;; The tests need 'grep' with perl regexp support.
4848 ("grep" ,grep)))
4849 (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
4850 (synopsis "Create and manage btrfs copy-on-write file systems")
4851 (description "Btrfs is a @dfn{copy-on-write} (CoW) file system for Linux
4852 aimed at implementing advanced features while focusing on fault tolerance,
4853 repair and easy administration.")
4854 ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
4855 ;; GPL2: Everything else.
4856 (license (list license:gpl2 license:gpl2+))))
4857
4858 (define-public btrfs-progs/static
4859 (package
4860 (name "btrfs-progs-static")
4861 (version (package-version btrfs-progs))
4862 (source #f)
4863 (build-system trivial-build-system)
4864 (inputs
4865 `(("btrfs-progs:static" ,btrfs-progs "static")))
4866 (arguments
4867 `(#:modules ((guix build utils))
4868 #:builder
4869 (begin
4870 (use-modules (guix build utils)
4871 (ice-9 ftw)
4872 (srfi srfi-26))
4873
4874 (let* ((btrfs (assoc-ref %build-inputs "btrfs-progs:static"))
4875 (out (assoc-ref %outputs "out"))
4876 (source (string-append btrfs "/bin/btrfs.static"))
4877 (target (string-append out "/bin/btrfs")))
4878 (mkdir-p (dirname target))
4879 (copy-file source target)
4880 (remove-store-references target)
4881 (chmod target #o555)
4882 #t))))
4883 (home-page (package-home-page btrfs-progs))
4884 (synopsis "Statically-linked btrfs command from btrfs-progs")
4885 (description "This package provides the statically-linked @command{btrfs}
4886 from the btrfs-progs package. It is meant to be used in initrds.")
4887 (license (package-license btrfs-progs))))
4888
4889 (define-public cramfs-tools
4890 (package
4891 (name "cramfs-tools")
4892 (home-page "https://github.com/npitre/cramfs-tools")
4893 (version "2.1")
4894 (source (origin
4895 (method git-fetch)
4896 (uri (git-reference
4897 (url home-page)
4898 (commit (string-append "v" version))))
4899 (sha256
4900 (base32 "183rfqqyzx52q0vxicdgf0p984idh3rqkvzfb93gjvyzfhc15c0p"))
4901 (file-name (git-file-name name version))))
4902 (build-system gnu-build-system)
4903 (arguments
4904 '(#:tests? #f ; No tests.
4905 #:phases
4906 (modify-phases %standard-phases
4907 (delete 'configure)
4908 (replace 'install
4909 (lambda* (#:key outputs #:allow-other-keys)
4910 (let ((out (assoc-ref outputs "out")))
4911 (install-file "mkcramfs" (string-append out "/sbin"))
4912 (install-file "cramfsck" (string-append out "/sbin")))
4913 #t)))))
4914 (inputs
4915 `(("zlib" ,zlib)))
4916 (synopsis "Tools to manage Cramfs file systems")
4917 (description "Cramfs is a Linux file system designed to be simple, small,
4918 and to compress things well. It is used on a number of embedded systems and
4919 small devices. This version has additional features such as uncompressed
4920 blocks and random block placement.")
4921 (license license:gpl2+)))
4922
4923 (define-public compsize
4924 (package
4925 (name "compsize")
4926 (version "1.3")
4927 (home-page "https://github.com/kilobyte/compsize")
4928 (source (origin
4929 (method git-fetch)
4930 (uri (git-reference
4931 (url home-page)
4932 (commit (string-append "v" version))))
4933 (sha256
4934 (base32 "1c69whla844nwis30jxbj00zkpiw3ccndhkmzjii8av5358mjn43"))
4935 (file-name (git-file-name name version))))
4936 (build-system gnu-build-system)
4937 (inputs
4938 `(("btrfs-progs" ,btrfs-progs)))
4939 (arguments
4940 `(#:tests? #f ; No tests.
4941 #:make-flags (list "CC=gcc")
4942 #:phases
4943 (modify-phases %standard-phases
4944 (delete 'configure)
4945 (replace 'install
4946 (lambda* (#:key outputs #:allow-other-keys)
4947 (let ((out (assoc-ref outputs "out")))
4948 (install-file "compsize" (string-append out "/bin"))
4949 (install-file "compsize.8" (string-append out "/share/man/man8"))))))))
4950 (synopsis "Find compression type/ratio on Btrfs files")
4951 (description "@command{compsize} takes a list of files (given as
4952 arguments) on a Btrfs file system and measures used compression types and
4953 effective compression ratio, producing a report.
4954
4955 A directory has no extents but has a (recursive) list of files. A non-regular
4956 file is silently ignored.
4957
4958 As it makes no sense to talk about compression ratio of a partial extent,
4959 every referenced extent is counted whole, exactly once -- no matter if you use
4960 only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the
4961 uncompressed size will not match the number given by @command{tar} or
4962 @command{du}. On the other hand, the space used should be accurate (although
4963 obviously it can be shared with files outside our set).")
4964 (license license:gpl2+)))
4965
4966 (define-public f2fs-tools-1.7
4967 (package
4968 (name "f2fs-tools")
4969 (version "1.7.0")
4970 (source (origin
4971 (method url-fetch)
4972 (uri (string-append
4973 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
4974 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
4975 (sha256
4976 (base32
4977 "1m6bn1ibq0p53m0n97il91xqgjgn2pzlz74lb5bfzassx7159m1k"))))
4978
4979 (build-system gnu-build-system)
4980 (arguments
4981 `(#:phases
4982 (modify-phases %standard-phases
4983 (add-after 'install 'install-headers
4984 (lambda* (#:key outputs #:allow-other-keys)
4985 (let* ((out (assoc-ref outputs "out"))
4986 (out-include (string-append out "/include")))
4987 (install-file "include/f2fs_fs.h" out-include)
4988 (install-file "mkfs/f2fs_format_utils.h" out-include)
4989 #t))))))
4990 (native-inputs
4991 `(("autoconf" ,autoconf)
4992 ("automake" ,automake)
4993 ("libtool" ,libtool)
4994 ("pkg-config" ,pkg-config)))
4995 (inputs
4996 `(("libuuid" ,util-linux "lib")
4997 ("libselinux" ,libselinux)))
4998 (home-page "https://f2fs.wiki.kernel.org/")
4999 (synopsis "Userland tools for f2fs")
5000 (description
5001 "F2FS, the Flash-Friendly File System, is a modern file system
5002 designed to be fast and durable on flash devices such as solid-state
5003 disks and SD cards. This package provides the userland utilities.")
5004 ;; The formatting utility, libf2fs and include/f2fs_fs.h is dual
5005 ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
5006 (license (list license:gpl2 license:lgpl2.1))))
5007
5008 (define-public f2fs-tools
5009 (package
5010 (inherit f2fs-tools-1.7)
5011 (name "f2fs-tools")
5012 (version "1.13.0")
5013 (source (origin
5014 (method url-fetch)
5015 (uri (string-append
5016 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
5017 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
5018 (sha256
5019 (base32
5020 "0z9c0y3qq75iyqknl5k0v7v46l8c3pcifpqb0yqalrs24blkm7dk"))))
5021 (inputs
5022 `(("libuuid" ,util-linux "lib")))))
5023
5024 (define-public f2fs-tools/static
5025 (static-package
5026 (package
5027 (inherit f2fs-tools)
5028 (name "f2fs-tools-static")
5029 (arguments
5030 `(#:configure-flags
5031 (let ((libuuid-static (assoc-ref %build-inputs "libuuid:static"))
5032 (libuuid (assoc-ref %build-inputs "libuuid")))
5033 (list
5034 (string-append "libuuid_CFLAGS=-I" libuuid "/include")
5035 (string-append "libuuid_LIBS=-L" libuuid-static "/lib -luuid")
5036 (string-append "libblkid_CFLAGS=-I" libuuid "/include")
5037 (string-append "libblkid_LIBS=-L" libuuid-static "/lib -lblkid")))
5038 #:disallowed-references (,util-linux)
5039 #:phases
5040 (modify-phases %standard-phases ; TODO: f2fs phases.
5041 (add-after 'unpack 'make-static
5042 (lambda _
5043 (define (append-to-file name body)
5044 (let ((file (open-file name "a")))
5045 (display body file)
5046 (close-port file)))
5047 (append-to-file "mkfs/Makefile.am" "\nmkfs_f2fs_LDFLAGS = -all-static\n")
5048 (append-to-file "fsck/Makefile.am" "\nfsck_f2fs_LDFLAGS = -all-static\n")
5049 (append-to-file "tools/Makefile.am" "\nf2fscrypt_LDFLAGS = -all-static -luuid\n")
5050 #t))
5051 (add-after 'install 'remove-store-references
5052 (lambda* (#:key outputs #:allow-other-keys)
5053 ;; Work around bug in our util-linux.
5054 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41019>.
5055 (remove-store-references (string-append (assoc-ref outputs "out")
5056 "/sbin/mkfs.f2fs"))
5057 #t)))))
5058 (inputs
5059 `(("libuuid:static" ,util-linux "static")
5060 ("libuuid" ,util-linux "lib")))))) ; for include files
5061
5062 (define-public f2fs-fsck/static
5063 (package
5064 (name "f2fs-fsck-static")
5065 (version (package-version f2fs-tools/static))
5066 (source #f)
5067 (build-system trivial-build-system)
5068 (arguments
5069 `(#:modules ((guix build utils))
5070 #:builder
5071 (begin
5072 (use-modules (guix build utils)
5073 (ice-9 ftw)
5074 (srfi srfi-26))
5075 (let* ((f2fs-tools (assoc-ref %build-inputs "f2fs-tools-static"))
5076 (fsck "fsck.f2fs")
5077 (out (assoc-ref %outputs "out"))
5078 (sbin (string-append out "/sbin")))
5079 (mkdir-p sbin)
5080 (with-directory-excursion sbin
5081 (install-file (string-append f2fs-tools "/sbin/" fsck)
5082 ".")
5083 (remove-store-references fsck)
5084 (chmod fsck #o555))
5085 #t))))
5086 (inputs
5087 `(("f2fs-tools-static" ,f2fs-tools/static)))
5088 (home-page (package-home-page f2fs-tools/static))
5089 (synopsis "Statically-linked fsck.f2fs command from f2fs-tools")
5090 (description "This package provides statically-linked fsck.f2fs command taken
5091 from the f2fs-tools package. It is meant to be used in initrds.")
5092 (license (package-license f2fs-tools/static))))
5093
5094 (define-public freefall
5095 (package
5096 (name "freefall")
5097 (version (package-version linux-libre))
5098 (source (package-source linux-libre))
5099 (build-system gnu-build-system)
5100 (arguments
5101 '(#:phases (modify-phases %standard-phases
5102 (add-after 'unpack 'enter-subdirectory
5103 (lambda _
5104 (chdir "tools/laptop/freefall")
5105 #t))
5106 (delete 'configure)
5107 (add-before 'build 'increase-timeout
5108 (lambda _
5109 ;; The default of 2 seconds is too low: it assumes an
5110 ;; open lid and AC power without actually checking.
5111 (substitute* "freefall.c"
5112 (("alarm\\(2\\)") "alarm(5)"))
5113 #t)))
5114 #:make-flags (list (string-append "PREFIX="
5115 (assoc-ref %outputs "out"))
5116 "CC=gcc")
5117 #:tests? #f)) ;no tests
5118 (home-page (package-home-page linux-libre))
5119 (synopsis "Free-fall protection for spinning laptop hard drives")
5120 (description
5121 "Prevents shock damage to the internal spinning hard drive(s) of some
5122 HP and Dell laptops. When sudden movement is detected, all input/output
5123 operations on the drive are suspended and its heads are parked on the ramp,
5124 where they are less likely to cause damage to the spinning disc. Requires a
5125 drive that supports the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
5126 feature, and a laptop with an accelerometer. It has no effect on SSDs.")
5127 (license license:gpl2)))
5128
5129 (define-public thinkfan
5130 (package
5131 (name "thinkfan")
5132 (version "1.2.1")
5133 (source
5134 (origin
5135 (method git-fetch)
5136 (uri (git-reference
5137 (url "https://github.com/vmatare/thinkfan")
5138 (commit version)))
5139 (file-name (git-file-name name version))
5140 (sha256
5141 (base32 "18vgm5w5pjnpipa34j4x87q10695w2jnqwvc2f027afy7mnzw7kz"))))
5142 (build-system cmake-build-system)
5143 (arguments
5144 `(#:modules ((guix build cmake-build-system)
5145 (guix build utils)
5146 (srfi srfi-26))
5147 #:tests? #f ; no test target
5148 #:configure-flags
5149 ;; Enable reading temperatures from hard disks via S.M.A.R.T.
5150 ;; Upstream ‘defaults to OFF because libatasmart seems to be horribly
5151 ;; inefficient’.
5152 `("-DUSE_ATASMART:BOOL=ON")
5153 #:phases
5154 (modify-phases %standard-phases
5155 (add-after 'unpack 'create-init-scripts
5156 ;; CMakeLists.txt relies on build-time symptoms of OpenRC and
5157 ;; systemd to patch and install their service files. Fake their
5158 ;; presence rather than duplicating the build system below. Leave
5159 ;; things like ‘/bin/kill’ because they're not worth a dependency.
5160 ;; The sysvinit needs manual patching, but since upstream doesn't
5161 ;; even provide the option to install it: don't.
5162 (lambda* (#:key outputs #:allow-other-keys)
5163 (let* ((out (assoc-ref outputs "out"))
5164 (share (string-append out "/share/" ,name)))
5165 (substitute* "CMakeLists.txt"
5166 (("pkg_check_modules\\((OPENRC|SYSTEMD) .*" _ package)
5167 (format #f "option(~a_FOUND \"Faked\" ON)\n" package))
5168 ;; That was easy! Now we just need to fix the destinations.
5169 (("/etc" directory)
5170 (string-append out directory)))
5171 #t))))))
5172 (native-inputs
5173 `(("pkg-config" ,pkg-config)))
5174 (inputs
5175 `(("libatasmart" ,libatasmart)
5176 ("yaml-cpp" ,yaml-cpp)))
5177 (home-page "https://github.com/vmatare/thinkfan")
5178 (synopsis "Simple fan control program")
5179 (description
5180 "Thinkfan is a simple fan control program. It reads temperatures,
5181 checks them against configured limits and switches to appropriate (also
5182 pre-configured) fan level. It requires a working @code{thinkpad_acpi} or any
5183 other @code{hwmon} driver that enables temperature reading and fan control
5184 from userspace.")
5185 (license license:gpl3+)))
5186
5187 (define-public tpacpi-bat
5188 (package
5189 (name "tpacpi-bat")
5190 (version "3.1")
5191 (source
5192 (origin
5193 (method git-fetch)
5194 (uri (git-reference
5195 (url "https://github.com/teleshoes/tpacpi-bat")
5196 (commit (string-append "v" version))))
5197 (file-name (git-file-name name version))
5198 (sha256
5199 (base32 "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5"))))
5200 (build-system gnu-build-system)
5201 (arguments
5202 `(#:tests? #f ; no test target
5203 #:phases
5204 (modify-phases %standard-phases
5205 (add-after 'unpack 'refer-to-inputs
5206 (lambda _
5207 (substitute* "tpacpi-bat"
5208 (("cat ")
5209 (format #f "~a " (which "cat")))
5210 ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
5211 ;; loaded. That's the administrator's prerogative; disable it.
5212 (("system \"(modprobe .*)\"" _ match)
5213 (format #f "die \"Please run ‘~a’ first.\\n\"" match)))
5214 #t))
5215 (delete 'configure) ; nothing to configure
5216 (delete 'build) ; nothing to build
5217 (replace 'install
5218 (lambda* (#:key outputs #:allow-other-keys)
5219 (let* ((out (assoc-ref outputs "out"))
5220 (bin (string-append out "/bin"))
5221 (doc (string-append out "/share/doc/" ,name "-" ,version)))
5222 (install-file "tpacpi-bat" bin)
5223
5224 ;; There's no man page. Install other forms of documentation.
5225 (for-each (lambda (file)
5226 (let ((target (string-append doc "/" file)))
5227 (mkdir-p (dirname target))
5228 (copy-recursively file target)))
5229 (list "battery_asl" "examples" "README.md"))
5230 #t))))))
5231 (inputs
5232 `(("perl" ,perl)))
5233 (home-page "https://github.com/teleshoes/tpacpi-bat")
5234 (synopsis "ThinkPad battery charge controller")
5235 (description
5236 "Tpacpi-bat is a command-line interface to control battery charging on
5237 @uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
5238 ThinkPad models released after 2011}, starting with the xx20 series. It can
5239 query and set the thresholds at which one or both batteries will start and stop
5240 charging, inhibit charging batteries for a set period of time, or force them to
5241 discharge when they otherwise would not.
5242
5243 This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
5244 kernel module provided by the @code{acpi-call-linux-module} package, which must
5245 be installed and loaded separately. Only the original vendor firmware is
5246 supported.")
5247 (license license:gpl3+)))
5248
5249 (define-public ntfs-3g
5250 (package
5251 (name "ntfs-3g")
5252 (version "2017.3.23")
5253 (source (origin
5254 (method url-fetch)
5255 (uri (string-append "https://tuxera.com/opensource/"
5256 "ntfs-3g_ntfsprogs-" version ".tgz"))
5257 (patches (search-patches "ntfs-3g-CVE-2019-9755.patch"))
5258 (sha256
5259 (base32
5260 "1mb228p80hv97pgk3myyvgp975r9mxq56c6bdn1n24kngcfh4niy"))
5261 (modules '((guix build utils)))
5262 (snippet '(begin
5263 ;; Install under $prefix.
5264 (substitute* '("src/Makefile.in" "ntfsprogs/Makefile.in")
5265 (("/sbin")
5266 "@sbindir@"))
5267 #t))))
5268 (build-system gnu-build-system)
5269 (inputs `(("util-linux" ,util-linux)
5270 ("fuse" ,fuse))) ;libuuid
5271 (native-inputs `(("pkg-config" ,pkg-config)))
5272 (arguments
5273 '(#:configure-flags (list "--exec-prefix=${prefix}"
5274 "--with-fuse=external" ;use our own FUSE
5275 "--enable-mount-helper"
5276 "--enable-posix-acls"
5277 "--enable-xattr-mappings")
5278 #:phases
5279 (modify-phases %standard-phases
5280 ;; If users install ntfs-3g, they probably want to make it the
5281 ;; default driver as well, so we opt for sensible defaults and link
5282 ;; mount.ntfs to mount.ntfs-3g. (libmount tries to run mount.ntfs to
5283 ;; mount NTFS file systems.)
5284 (add-after 'install 'install-link
5285 (lambda* (#:key outputs #:allow-other-keys)
5286 (let* ((out (assoc-ref outputs "out"))
5287 (sbin (string-append out "/sbin")))
5288 (symlink "mount.ntfs-3g"
5289 (string-append sbin "/mount.ntfs")))
5290 #t)))))
5291 (home-page "https://www.tuxera.com/community/open-source-ntfs-3g/")
5292 (synopsis "Read-write access to NTFS file systems")
5293 (description
5294 "NTFS-3G provides read-write access to NTFS file systems, which are
5295 commonly found on Microsoft Windows. It is implemented as a FUSE file system.
5296 The package provides additional NTFS tools.")
5297 (license license:gpl2+)))
5298
5299 (define-public rdma-core
5300 (package
5301 (name "rdma-core")
5302 (version "26.0")
5303 (source (origin
5304 (method url-fetch)
5305 (uri (string-append "https://github.com/linux-rdma/rdma-core"
5306 "/releases/download/v" version "/rdma-core-"
5307 version ".tar.gz"))
5308 (sha256
5309 (base32
5310 "14raqwx4pkzghiwkx1v0dq338f7xqqx8rnsxlpdnngvjy1p5l79j"))))
5311 (build-system cmake-build-system)
5312 (arguments
5313 `(#:tests? #f ; no tests
5314 ;; Upstream uses the "ninja" build system and encourage distros
5315 ;; to do the same for consistency. They also recommend using the
5316 ;; "Release" build type.
5317 #:build-type "Release"
5318 #:configure-flags (list "-GNinja"
5319
5320 (string-append "-DRST2MAN_EXECUTABLE="
5321 (assoc-ref %build-inputs
5322 "python-docutils")
5323 "/bin/rst2man.py")
5324
5325 ;; On some configurations, the
5326 ;; IB_USER_MAD_REGISTER_AGENT ioctl, which is
5327 ;; used by default, would return ENODEV. To
5328 ;; avoid that, use 'write' instead of ioctls,
5329 ;; as suggested in 'CMakeList.txt'.
5330 "-DIOCTL_MODE=write")
5331 #:phases
5332 (modify-phases %standard-phases
5333 (replace 'build
5334 (lambda _
5335 (invoke "ninja"
5336 "-j" (number->string (parallel-job-count)))))
5337 (replace 'install
5338 (lambda _
5339 (invoke "ninja" "install"))))))
5340 (native-inputs
5341 `(("ninja" ,ninja)
5342 ("pkg-config" ,pkg-config)
5343 ("python" ,python-wrapper)
5344 ("python-docutils" ,python-docutils))) ;for 'rst2man'
5345 (inputs
5346 `(("libnl" ,libnl)
5347 ("udev" ,eudev)))
5348 (home-page "https://github.com/linux-rdma/rdma-core")
5349 (synopsis "Utilities and libraries for working with RDMA devices")
5350 (description
5351 "This package provides userspace components for the InfiniBand
5352 subsystem of the Linux kernel. Specifically it contains userspace
5353 libraries for the following device nodes:
5354
5355 @enumerate
5356 @item @file{/dev/infiniband/uverbsX} (@code{libibverbs})
5357 @item @file{/dev/infiniband/rdma_cm} (@code{librdmacm})
5358 @item @file{/dev/infiniband/umadX} (@code{libibumad})
5359 @end enumerate
5360
5361 The following service daemons are also provided:
5362 @enumerate
5363 @item @code{srp_daemon} (for the @code{ib_srp} kernel module)
5364 @item @code{iwpmd} (for iWARP kernel providers)
5365 @item @code{ibacm} (for InfiniBand communication management assistant)
5366 @end enumerate")
5367 ;; All library code is dual licensed under GPL2 and a custom MIT
5368 ;; variant. The package also includes some components covered by
5369 ;; other licenses. Consult COPYING.md for full details.
5370 (license
5371 (list license:gpl2
5372 (license:x11-style "See COPYING.BSD_MIT in the distribution")
5373 license:bsd-2 ; Files referring to COPYING.BSD_FB
5374 license:cc0 ; most files in ccan/
5375 license:bsd-3)))) ; providers/hfi1verbs are dual GPL2/BSD-3
5376
5377 (define-public perftest
5378 (package
5379 (name "perftest")
5380 (version "4.4-0.4")
5381 (source
5382 (origin
5383 (method url-fetch)
5384 (uri (string-append "https://github.com/linux-rdma/perftest/releases/download/v"
5385 version "/perftest-" version ".g0927198.tar.gz"))
5386 (sha256
5387 (base32 "11ix4h0rrmqqyi84y55a9xnkvwsmwq0sywr46hvxzm4rqz4ma8vq"))))
5388 (build-system gnu-build-system)
5389 (arguments
5390 `(#:phases
5391 (modify-phases %standard-phases
5392 (add-after 'unpack 'patch-header-paths
5393 (lambda _
5394 (substitute* '("src/raw_ethernet_fs_rate.c"
5395 "src/raw_ethernet_resources.c"
5396 "src/raw_ethernet_resources.h"
5397 "src/raw_ethernet_send_burst_lat.c"
5398 "src/raw_ethernet_send_bw.c"
5399 "src/raw_ethernet_send_lat.c")
5400 (("/usr/include/netinet/ip.h") "netinet/ip.h"))
5401 #t)))))
5402 (inputs `(("rdma-core" ,rdma-core)))
5403 (home-page "https://github.com/linux-rdma/perftest/")
5404 (synopsis "Open Fabrics Enterprise Distribution (OFED) Performance Tests")
5405 (description "This is a collection of tests written over uverbs intended for
5406 use as a performance micro-benchmark. The tests may be used for hardware or
5407 software tuning as well as for functional testing.
5408
5409 The collection contains a set of bandwidth and latency benchmark such as:
5410 @enumerate
5411 @item Send - @code{ib_send_bw} and @code{ib_send_lat}
5412 @item RDMA Read - @code{ib_read_bw} and @code{ib_read_lat}
5413 @item RDMA Write - @code{ib_write_bw} and @code{ib_wriet_lat}
5414 @item RDMA Atomic - @code{ib_atomic_bw} and @code{ib_atomic_lat}
5415 @item Native Ethernet (when working with MOFED2) - @code{raw_ethernet_bw}, @code{raw_ethernet_lat}
5416 @end enumerate")
5417 (license license:gpl2)))
5418
5419 (define-public rng-tools
5420 (package
5421 (name "rng-tools")
5422 (home-page "https://github.com/nhorman/rng-tools")
5423 (version "6.10")
5424 (source (origin
5425 (method git-fetch)
5426 (uri (git-reference (url home-page)
5427 (commit (string-append "v" version))))
5428 (file-name (git-file-name name version))
5429 (sha256
5430 (base32
5431 "0hbml37yxs0fs69g7f2x4ixq61z0029swy99rn7ykma9mi6b7ni9"))))
5432 (build-system gnu-build-system)
5433 (arguments
5434 `(;; Disable support for various hardware entropy sources as they need
5435 ;; dependencies that are not yet in Guix, and would significantly
5436 ;; increase closure size.
5437 #:configure-flags '("--without-nistbeacon"
5438 "--without-pkcs11"
5439 "--without-rtlsdr")))
5440 (native-inputs
5441 `(("autoconf" ,autoconf)
5442 ("automake" ,automake)
5443 ("pkg-config" ,pkg-config)))
5444 (inputs
5445 `(("libsysfs" ,sysfsutils)
5446 ("openssl" ,openssl)))
5447 (synopsis "Random number generator daemon")
5448 (description
5449 "Monitor a hardware random number generator, and supply entropy
5450 from that to the system kernel's @file{/dev/random} machinery.")
5451 ;; The source package is offered under the GPL2+, but the files
5452 ;; 'rngd_rdrand.c' and 'rdrand_asm.S' are only available under the GPL2.
5453 (license (list license:gpl2 license:gpl2+))))
5454
5455 (define-public cpupower
5456 (package
5457 (name "cpupower")
5458 (version (package-version linux-libre))
5459 (source (package-source linux-libre))
5460 (build-system gnu-build-system)
5461 (arguments
5462 '(#:phases (modify-phases %standard-phases
5463 (add-after 'unpack 'enter-subdirectory
5464 (lambda _
5465 (chdir "tools/power/cpupower")
5466 #t))
5467 (delete 'configure)
5468 (add-before 'build 'fix-makefiles
5469 (lambda _
5470 (substitute* "Makefile"
5471 (("/usr/") "/")
5472 (("/bin/(install|pwd)" _ command) command))
5473 (substitute* "bench/Makefile"
5474 (("\\$\\(CC\\) -o") "$(CC) $(LDFLAGS) -o"))
5475 #t)))
5476 #:make-flags (let ((out (assoc-ref %outputs "out")))
5477 (list (string-append "DESTDIR=" out)
5478 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")
5479 "libdir=/lib"
5480 "docdir=/share/doc/cpupower"
5481 "confdir=$(docdir)/examples"
5482 ;; The Makefile recommends the following changes
5483 "DEBUG=false"
5484 "PACKAGE_BUGREPORT=bug-guix@gnu.org"))
5485 #:tests? #f)) ;no tests
5486 (native-inputs `(("gettext" ,gettext-minimal)))
5487 (inputs `(("pciutils" ,pciutils)))
5488 (home-page (package-home-page linux-libre))
5489 (synopsis "CPU frequency and voltage scaling tools for Linux")
5490 (description
5491 "cpupower is a set of user-space tools that use the cpufreq feature of the
5492 Linux kernel to retrieve and control processor features related to power saving,
5493 such as frequency and voltage scaling.")
5494 (license license:gpl2)))
5495
5496 (define-public x86-energy-perf-policy
5497 (package
5498 (name "x86-energy-perf-policy")
5499 (version (package-version linux-libre))
5500 (source (package-source linux-libre))
5501 (build-system gnu-build-system)
5502 (arguments
5503 '(#:tests? #f
5504 #:phases
5505 (modify-phases %standard-phases
5506 (add-after 'unpack 'enter-subdirectory
5507 (lambda _
5508 (chdir "tools/power/x86/x86_energy_perf_policy")
5509 #t))
5510 (delete 'configure)
5511 (add-before 'build 'fix-makefile
5512 (lambda _
5513 (substitute* "Makefile" (("/usr") ""))
5514 #t)))
5515 #:make-flags
5516 (let ((out (assoc-ref %outputs "out")))
5517 (list (string-append "DESTDIR=" out)
5518 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
5519 (supported-systems '("i686-linux" "x86_64-linux"))
5520 (home-page (package-home-page linux-libre))
5521 (synopsis "Display and update Intel-CPU energy-performance policy")
5522 (description
5523 "@command{x86_energy_perf_policy} displays and updates energy-performance
5524 policy settings specific to Intel Architecture Processors. Settings are
5525 accessed via Model Specific Register (MSR) updates, no matter if the Linux
5526 cpufreq sub-system is enabled or not.")
5527 (license license:gpl2)))
5528
5529 (define-public haveged
5530 (package
5531 (name "haveged")
5532 (version "1.9.13")
5533 (source
5534 (origin
5535 (method git-fetch)
5536 (uri (git-reference
5537 (url "https://github.com/jirka-h/haveged")
5538 (commit (string-append "v" version))))
5539 (file-name (git-file-name name version))
5540 (sha256
5541 (base32 "0g3hcvpky76cabgcfqh65fay7nnjkms32sgmlf33q969833hijqz"))))
5542 (build-system gnu-build-system)
5543 (home-page "https://www.issihosts.com/haveged")
5544 (synopsis "Entropy source for the Linux random number generator")
5545 (description
5546 "haveged generates an unpredictable stream of random numbers for use by
5547 Linux's @file{/dev/random} and @file{/dev/urandom} devices. The kernel's
5548 standard mechanisms for filling the entropy pool may not be sufficient for
5549 systems with high needs or limited user interaction, such as headless servers.
5550
5551 @command{haveged} runs as a privileged daemon, harvesting randomness from the
5552 indirect effects of hardware events on hidden processor state using the
5553 @acronym{HAVEGE, HArdware Volatile Entropy Gathering and Expansion} algorithm.
5554 It tunes itself to its environment and provides the same built-in test suite
5555 for the output stream as used on certified hardware security devices.
5556
5557 The quality of the randomness produced by this algorithm has not been proven.
5558 It is recommended to run it together with another entropy source like rngd, and
5559 not as a replacement for it.")
5560 (license (list (license:non-copyleft "file://nist/mconf.h")
5561 (license:non-copyleft "file://nist/packtest.c")
5562 license:public-domain ; nist/dfft.c
5563 license:gpl3+)))) ; everything else
5564
5565 (define-public ecryptfs-utils
5566 (package
5567 (name "ecryptfs-utils")
5568 (version "111")
5569 (source
5570 (origin
5571 (method url-fetch)
5572 (uri (string-append "https://launchpad.net/ecryptfs/trunk/"
5573 version "/+download/ecryptfs-utils_"
5574 version ".orig.tar.gz"))
5575 (sha256
5576 (base32
5577 "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"))))
5578 (build-system gnu-build-system)
5579 (arguments
5580 `(#:configure-flags (list "--disable-pywrap")
5581 #:phases
5582 (modify-phases %standard-phases
5583 (add-after 'patch-source-shebangs 'patch-hardcoded-paths
5584 (lambda* (#:key inputs outputs #:allow-other-keys)
5585 (let ((out (assoc-ref outputs "out"))
5586 (utils-linux (assoc-ref inputs "utils-linux"))
5587 (cryptsetup (assoc-ref inputs "cryptsetup"))
5588 (linux-pam (assoc-ref inputs "linux-pam"))
5589 (lvm2 (assoc-ref inputs "lvm2")))
5590 (substitute* '("src/utils/ecryptfs-mount-private"
5591 "src/utils/ecryptfs-umount-private"
5592 "src/utils/ecryptfs-setup-private"
5593 "src/utils/ecryptfs-setup-swap"
5594 "src/utils/mount.ecryptfs.c"
5595 "src/utils/umount.ecryptfs.c"
5596 "src/pam_ecryptfs/pam_ecryptfs.c"
5597 "src/desktop/ecryptfs-mount-private.desktop.in"
5598 "src/desktop/ecryptfs-setup-private.desktop.in")
5599 (("/bin/mount")
5600 (string-append utils-linux "/bin/mount"))
5601 (("/bin/umount")
5602 (string-append utils-linux "/bin/umount"))
5603 (("/sbin/mount.ecryptfs_private")
5604 (string-append out "/sbin/mount.ecryptfs_private"))
5605 (("/sbin/umount.ecryptfs_private")
5606 (string-append out "/sbin/umount.ecryptfs_private"))
5607 (("/usr/bin/ecryptfs-mount-private")
5608 (string-append out "/bin/ecryptfs-mount-private"))
5609 (("/usr/bin/ecryptfs-rewrite-file")
5610 (string-append out "/bin/ecryptfs-rewrite-file"))
5611 (("/usr/bin/ecryptfs-setup-private")
5612 (string-append out "/bin/ecryptfs-setup-private"))
5613 (("/sbin/cryptsetup")
5614 (string-append cryptsetup "/sbin/cryptsetup"))
5615 (("/sbin/unix_chkpwd")
5616 (string-append linux-pam "/sbin/unix_chkpwd"))
5617 (("/sbin/dmsetup")
5618 (string-append lvm2 "/sbin/dmsetup")))))))))
5619 (native-inputs
5620 `(("intltool" ,intltool)
5621 ("perl" ,perl) ; for pod2man
5622 ("pkg-config" ,pkg-config)))
5623 (inputs
5624 `(("keyutils" ,keyutils)
5625 ("linux-pam" ,linux-pam)
5626 ("utils-linux" ,util-linux)
5627 ("cryptsetup" ,cryptsetup)
5628 ("lvm2" ,lvm2)
5629 ("nss" ,nss)))
5630 (home-page "https://ecryptfs.org/")
5631 (synopsis "eCryptfs cryptographic file system utilities")
5632 (description
5633 "eCryptfs is a POSIX-compliant stacked cryptographic file system for Linux.
5634 Each file's cryptographic meta-data is stored inside the file itself, along
5635 with the encrypted contents. This allows individual encrypted files to be
5636 copied between hosts and still be decrypted with the proper key. eCryptfs is a
5637 native Linux file system, and has been part of the Linux kernel since version
5638 2.6.19. This package contains the userland utilities to manage it.")
5639 ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
5640 ;; grant additional permission to link with OpenSSL.
5641 (license license:gpl2+)))
5642
5643 (define-public libnfsidmap
5644 (package
5645 (name "libnfsidmap")
5646 (version "0.27")
5647 (source
5648 (origin
5649 (method url-fetch)
5650 (uri (string-append "https://fedorapeople.org/~steved/"
5651 name "/" version "/" name "-" version ".tar.bz2"))
5652 (sha256
5653 (base32 "0bg2bcii424mf1bnp3fssr8jszbvhdxl7wvifm1yf6g596v8b8i5"))))
5654 (build-system gnu-build-system)
5655 (arguments
5656 `(#:configure-flags (list
5657 (string-append "--with-pluginpath="
5658 (assoc-ref %outputs "out")
5659 "/lib/libnfsidmap"))))
5660 (native-inputs
5661 `(("autoconf" ,autoconf))) ; 0.27 still needs autoheader
5662 (home-page
5663 "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
5664 (synopsis "NFSv4 support library for name/ID mapping")
5665 (description "Libnfsidmap is a library holding mulitiple methods of
5666 mapping names to ids and visa versa, mainly for NFSv4. It provides an
5667 extensible array of mapping functions, currently consisting of two choices:
5668 the default @code{nsswitch} and the experimental @code{umich_ldap}.")
5669 (license (license:non-copyleft "file://COPYING"
5670 "See COPYING in the distribution."))))
5671
5672 (define-public module-init-tools
5673 (package
5674 (name "module-init-tools")
5675 (version "3.16")
5676 (source (origin
5677 (method url-fetch)
5678 (uri (string-append
5679 "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
5680 "module-init-tools-" version ".tar.bz2"))
5681 (sha256
5682 (base32
5683 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
5684 (patches (search-patches "module-init-tools-moduledir.patch"))))
5685 (build-system gnu-build-system)
5686 (arguments
5687 ;; FIXME: The upstream tarball lacks man pages, and building them would
5688 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
5689 ;; but they vanished. In the meantime, fake it.
5690 '(#:phases
5691 (modify-phases %standard-phases
5692 (add-before 'configure 'fake-docbook
5693 (lambda _
5694 (substitute* "Makefile.in"
5695 (("^DOCBOOKTOMAN.*$")
5696 "DOCBOOKTOMAN = true\n"))
5697 #t)))))
5698 (home-page "https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
5699 (synopsis "Tools for loading and managing Linux kernel modules")
5700 (description
5701 "Tools for loading and managing Linux kernel modules, such as
5702 @code{modprobe}, @code{insmod}, @code{lsmod}, and more.")
5703 (license license:gpl2+)))
5704
5705 (define-public mcelog
5706 (package
5707 (name "mcelog")
5708 (version "170")
5709 (source (origin
5710 (method url-fetch)
5711 (uri (string-append "https://git.kernel.org/cgit/utils/cpu/mce/"
5712 "mcelog.git/snapshot/v" version ".tar.gz"))
5713 (sha256
5714 (base32
5715 "1m11v1y7cvpm7hwsghj23z77ps1w5jzn8000iwiyxpb939h2km5l"))
5716 (file-name (string-append name "-" version ".tar.gz"))
5717 (modules '((guix build utils)))
5718 (snippet
5719 `(begin
5720 ;; The snapshots lack a .git directory,
5721 ;; breaking ‘git describe’.
5722 (substitute* "Makefile"
5723 (("\"unknown\"") (string-append "\"v" ,version "\"")))
5724 #t))))
5725 (build-system gnu-build-system)
5726 (arguments
5727 `(#:phases (modify-phases %standard-phases
5728 (delete 'configure)) ; no configure script
5729 #:make-flags (let ((out (assoc-ref %outputs "out")))
5730 (list "CC=gcc"
5731 (string-append "prefix=" out)
5732 (string-append "DOCDIR=" out "/share/doc/"
5733 ,name "-" ,version)
5734 "etcprefix=$(DOCDIR)/examples"))
5735 ;; The tests will only run as root on certain supported CPU models.
5736 #:tests? #f))
5737 (supported-systems (list "i686-linux" "x86_64-linux"))
5738 (home-page "https://mcelog.org/")
5739 (synopsis "Machine check monitor for x86 Linux systems")
5740 (description
5741 "The mcelog daemon logs memory, I/O, CPU, and other hardware errors on x86
5742 systems running the kernel Linux. It can also perform user-defined tasks, such
5743 as bringing bad pages off-line, when configurable error thresholds are
5744 exceeded.")
5745 (license license:gpl2)))
5746
5747 (define-public mtd-utils
5748 (package
5749 (name "mtd-utils")
5750 (version "2.1.2")
5751 (source (origin
5752 (method url-fetch)
5753 (uri (string-append
5754 "ftp://ftp.infradead.org/pub/mtd-utils/"
5755 "mtd-utils-" version ".tar.bz2"))
5756 (sha256
5757 (base32
5758 "1mp9fqgnz5r69s8ly98ry6k2blqnaqpllwi8m930dm0n8zrwbm4a"))))
5759 (arguments
5760 '(#:configure-flags '("--enable-unit-tests")))
5761 (native-inputs
5762 `(("cmocka" ,cmocka)
5763 ("pkg-config" ,pkg-config)))
5764 (inputs
5765 `(("acl" ,acl) ; extended attributes (xattr)
5766 ("libuuid" ,util-linux "lib")
5767 ("lzo" ,lzo)
5768 ("openssl" ,openssl) ; optional crypto support
5769 ("zlib" ,zlib)
5770 ("zstd" ,zstd "lib")))
5771 (build-system gnu-build-system)
5772 (synopsis "MTD Flash Storage Utilities")
5773 (description "This package provides utilities for testing, partitioning, etc
5774 of flash storage.")
5775 (home-page "http://www.linux-mtd.infradead.org/")
5776 (license
5777 (list license:gpl2 ; Almost everything is gpl2 or gpl2+
5778 license:mpl1.1 ; All ftl* files
5779 license:expat)))) ; libiniparser
5780
5781 (define-public libseccomp
5782 (package
5783 (name "libseccomp")
5784 (version "2.5.0")
5785 (source (origin
5786 (method url-fetch)
5787 (uri (string-append "https://github.com/seccomp/libseccomp/"
5788 "releases/download/v" version
5789 "/libseccomp-" version ".tar.gz"))
5790 (sha256
5791 (base32
5792 "1wql62cg8f95cwpy057cl764nni9g4sdn5lqj68x22kjs8w71yhz"))))
5793 (build-system gnu-build-system)
5794 (arguments
5795 '(#:configure-flags '("--disable-static")
5796 #:phases (modify-phases %standard-phases
5797 (add-before 'check 'skip-load-test
5798 (lambda _
5799 ;; This test does a native system call and fails when
5800 ;; run under QEMU user-mode emulation. Just skip it.
5801 (delete-file "tests/52-basic-load.tests")
5802 #t)))))
5803 (native-inputs
5804 `(("gperf" ,gperf)
5805 ("which" ,which)))
5806 (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
5807 (description "The libseccomp library provides an easy to use, platform
5808 independent, interface to the Linux Kernel's syscall filtering mechanism. The
5809 libseccomp API is designed to abstract away the underlying BPF based syscall
5810 filter language and present a more conventional function-call based filtering
5811 interface that should be familiar to, and easily adopted by, application
5812 developers.")
5813 (home-page "https://github.com/seccomp/libseccomp")
5814 (license license:lgpl2.1)))
5815
5816 (define-public radeontop
5817 (package
5818 (name "radeontop")
5819 (version "1.2")
5820 (source
5821 (origin
5822 (method git-fetch)
5823 (uri (git-reference
5824 (url "https://github.com/clbr/radeontop")
5825 (commit (string-append "v" version))))
5826 (file-name (git-file-name name version))
5827 (sha256
5828 (base32 "1b1m30r2nfwqkajqw6m01xmfhlq83z1qylyijxg7962mp9x2k0gw"))))
5829 (build-system gnu-build-system)
5830 (arguments
5831 `(#:phases (modify-phases %standard-phases
5832 ;; getver.sh uses ‘git --describe’, isn't worth an extra git
5833 ;; dependency, and doesn't even work on release(!) tarballs.
5834 (add-after 'unpack 'report-correct-version
5835 (lambda _
5836 (substitute* "getver.sh"
5837 (("ver=unknown")
5838 (string-append "ver=" ,version)))
5839 #t))
5840 (delete 'configure)) ; no configure script
5841 #:make-flags (list "CC=gcc"
5842 (string-append "PREFIX=" %output))
5843 #:tests? #f)) ; no tests
5844 (native-inputs
5845 `(("gettext" ,gettext-minimal)
5846 ("pkg-config" ,pkg-config)))
5847 (inputs
5848 `(("libdrm" ,libdrm)
5849 ("libpciaccess" ,libpciaccess)
5850 ("libxcb" ,libxcb)
5851 ("ncurses" ,ncurses)))
5852 (home-page "https://github.com/clbr/radeontop/")
5853 (synopsis "Usage monitor for AMD Radeon graphics")
5854 (description "RadeonTop monitors resource consumption on supported AMD
5855 Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
5856 a terminal or saved to a file for further processing. It measures both the
5857 activity of the GPU as a whole, which is also accurate during OpenCL
5858 computations, as well as separate component statistics that are only meaningful
5859 under OpenGL graphics workloads.")
5860 (license license:gpl3)))
5861
5862 (define-public efivar
5863 (package
5864 (name "efivar")
5865 (version "37")
5866 (source (origin
5867 (method url-fetch)
5868 (uri (string-append "https://github.com/rhboot/" name
5869 "/releases/download/" version "/" name
5870 "-" version ".tar.bz2"))
5871 (sha256
5872 (base32
5873 "17vvfivhsrszh7q39b6npjsrhrhsjf1cmmcpp3xrh6wh7ywzwrrw"))))
5874 (build-system gnu-build-system)
5875 (arguments
5876 `(;; Tests require a UEFI system and is not detected in the chroot.
5877 #:tests? #f
5878 #:make-flags (list (string-append "prefix=" %output)
5879 (string-append "libdir=" %output "/lib")
5880 "CC_FOR_BUILD=gcc"
5881 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
5882 #:phases
5883 (modify-phases %standard-phases
5884 (delete 'configure))))
5885 (native-inputs
5886 `(("pkg-config" ,pkg-config)))
5887 (inputs
5888 `(("popt" ,popt)))
5889 (home-page "https://github.com/rhboot/efivar")
5890 (synopsis "Tool and library to manipulate EFI variables")
5891 (description "This package provides a library and a command line
5892 interface to the variable facility of UEFI boot firmware.")
5893 (license license:lgpl2.1+)))
5894
5895 (define-public efibootmgr
5896 (package
5897 (name "efibootmgr")
5898 (version "16")
5899 (source (origin
5900 (method url-fetch)
5901 (uri (string-append "https://github.com/rhinstaller/efibootmgr"
5902 "/releases/download/" version "/efibootmgr"
5903 "-" version ".tar.bz2"))
5904 (sha256
5905 (base32
5906 "0pzn67vxxaf7jna4cd0i4kqm60h04kb21hckksv9z82q9gxra1wm"))))
5907 (build-system gnu-build-system)
5908 (arguments
5909 `(#:tests? #f ;no tests
5910 #:make-flags (list (string-append "prefix=" %output)
5911 (string-append "libdir=" %output "/lib")
5912 ;; EFIDIR denotes a subdirectory relative to the
5913 ;; EFI System Partition where the loader will be
5914 ;; installed (known as OS_VENDOR in the code).
5915 ;; GRUB overrides this, as such it's only used if
5916 ;; nothing else is specified on the command line.
5917 "EFIDIR=gnu")
5918 #:phases (modify-phases %standard-phases (delete 'configure))))
5919 (native-inputs
5920 `(("pkg-config" ,pkg-config)))
5921 (inputs
5922 `(("efivar" ,efivar)
5923 ("popt" ,popt)))
5924 (home-page "https://github.com/rhinstaller/efibootmgr")
5925 (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
5926 (description
5927 "@code{efibootmgr} is a user-space application to modify the Intel
5928 Extensible Firmware Interface (EFI) Boot Manager. This application can
5929 create and destroy boot entries, change the boot order, change the next
5930 running boot option, and more.")
5931 (license license:gpl2+)))
5932
5933 (define-public sysstat
5934 (package
5935 (name "sysstat")
5936 (version "12.4.0")
5937 (source (origin
5938 (method url-fetch)
5939 (uri (string-append "http://pagesperso-orange.fr/sebastien.godard/"
5940 "sysstat-" version ".tar.xz"))
5941 (sha256
5942 (base32
5943 "05idnvkhvzaynj9awx7q54x1v42jblzrxq0fn5zd1v4mjwrnqmbq"))))
5944 (build-system gnu-build-system)
5945 (arguments
5946 `(#:tests? #f ; no test suite.
5947 ;; Without this flag, it tries to install the man pages with group 'root'
5948 ;; and fails because /etc/passwd lacks an entry for the root user.
5949 #:configure-flags
5950 (list "--disable-file-attr"
5951 (string-append "conf_dir=" (assoc-ref %outputs "out") "/etc"))
5952 #:phases
5953 (modify-phases %standard-phases
5954 ;; The build process tries to create '/var/lib/sa', so we skip that
5955 ;; instruction.
5956 (add-after 'build 'skip-touching-var
5957 (lambda _
5958 (substitute* "Makefile"
5959 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(SA_DIR\\)")
5960 ""))
5961 #t)))))
5962 (home-page "http://sebastien.godard.pagesperso-orange.fr/")
5963 (synopsis "Performance monitoring tools for Linux")
5964 (description "The sysstat utilities are a collection of performance
5965 monitoring tools for Linux. These include @code{mpstat}, @code{iostat},
5966 @code{tapestat}, @code{cifsiostat}, @code{pidstat}, @code{sar}, @code{sadc},
5967 @code{sadf} and @code{sa}.")
5968 (license license:gpl2+)))
5969
5970 (define-public light
5971 (package
5972 (name "light")
5973 (version "1.2.2")
5974 (source
5975 (origin
5976 (method git-fetch)
5977 (uri (git-reference
5978 (url "https://github.com/haikarainen/light")
5979 (commit (string-append "v" version))))
5980 (sha256
5981 (base32 "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"))
5982 (file-name (git-file-name name version))))
5983 (build-system gnu-build-system)
5984 (arguments
5985 `(#:phases
5986 (modify-phases %standard-phases
5987 (add-after 'unpack 'patch-udev-rules-absolute-path-bins
5988 (lambda* (#:key inputs #:allow-other-keys)
5989 (substitute* "90-backlight.rules"
5990 (("/bin/chgrp") (which "chgrp"))
5991 (("/bin/chmod") (which "chmod")))
5992 #t))
5993 (add-after 'install 'install-udev-rules
5994 (lambda* (#:key outputs #:allow-other-keys)
5995 (let ((out (assoc-ref outputs "out")))
5996 (install-file
5997 "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
5998 #t))))))
5999 (native-inputs
6000 `(("autoconf" ,autoconf)
6001 ("automake" ,automake)))
6002 (home-page "https://haikarainen.github.io/light/")
6003 (synopsis "GNU/Linux application to control backlights")
6004 (description
6005 "Light is a program to send commands to screen backlight controllers
6006 under GNU/Linux. Features include:
6007
6008 @itemize
6009 @item It does not rely on X.
6010 @item Light can automatically figure out the best controller to use, making
6011 full use of underlying hardware.
6012 @item It is possible to set a minimum brightness value, as some controllers
6013 set the screen to be pitch black at a vaĺue of 0 (or higher).
6014 @end itemize
6015
6016 Light is the successor of lightscript.")
6017 (license license:gpl3+)))
6018
6019 (define-public brightnessctl
6020 (let ((commit "6a791e7694aeeb5d027f71c6098e5182cf03371c"))
6021 (package
6022 (name "brightnessctl")
6023 (version (git-version "0.4" "0" commit))
6024 (source (origin
6025 (method git-fetch)
6026 (uri (git-reference
6027 (url "https://github.com/Hummer12007/brightnessctl/")
6028 (commit commit)))
6029 (file-name (git-file-name name version))
6030 (sha256
6031 (base32
6032 "1n1gb8ldgqv3vs565yhk1w4jfvrviczp94r8wqlkv5q6ab43c8w9"))))
6033 (build-system gnu-build-system)
6034 (arguments
6035 '(#:tests? #f ; no tests
6036 #:make-flags (list "CC=gcc"
6037 (string-append "PREFIX=" %output)
6038 (string-append "UDEVDIR=" %output "/lib/udev/rules.d/"))
6039 #:phases
6040 (modify-phases %standard-phases
6041 (delete 'configure)
6042 (add-after 'unpack 'adjust-udev-rules
6043 (lambda _
6044 (substitute* "90-brightnessctl.rules"
6045 (("/bin/") "/run/current-system/profile/bin/"))
6046 #t)))))
6047 (home-page "https://github.com/Hummer12007/brightnessctl")
6048 (synopsis "Backlight and LED brightness control")
6049 (description
6050 "This program allows you read and control device brightness. Devices
6051 include backlight and LEDs. It can also preserve current brightness before
6052 applying the operation, such as on lid close.
6053
6054 The appropriate permissions must be set on the backlight or LED control
6055 interface in sysfs, which can be accomplished with the included udev rules.")
6056 (license license:expat))))
6057
6058 (define-public tlp
6059 (package
6060 (name "tlp")
6061 (version "1.3.1")
6062 (source
6063 (origin
6064 (method git-fetch)
6065 (uri (git-reference
6066 (url "https://github.com/linrunner/TLP")
6067 (commit version)))
6068 (file-name (git-file-name name version))
6069 (sha256
6070 (base32 "14fcnaz9pw534v4d8dddqq4wcvpf1kghr8zlrk62r5lrl46sp1p5"))))
6071 (native-inputs
6072 `(("shellcheck" ,shellcheck)))
6073 (inputs
6074 `(("bash" ,bash)
6075 ("dbus" ,dbus)
6076 ("ethtool" ,ethtool)
6077 ("eudev" ,eudev)
6078 ("grep" ,grep)
6079 ("hdparm" ,hdparm)
6080 ("inetutils" ,inetutils)
6081 ("iw" ,iw)
6082 ("kmod" ,kmod)
6083 ("pciutils" ,pciutils)
6084 ("perl" ,perl)
6085 ("rfkill" ,rfkill)
6086 ("sed" ,sed)
6087 ("usbutils" ,usbutils)
6088 ("util-linux" ,util-linux)
6089 ("wireless-tools" ,wireless-tools)
6090 ,@(if (let ((system (or (%current-target-system)
6091 (%current-system))))
6092 (or (string-prefix? "i686-" system)
6093 (string-prefix? "x86_64-" system)))
6094 `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
6095 '())))
6096 (build-system gnu-build-system)
6097 (arguments
6098 ;; XXX: The full test suite is run with "checkall" but it requires
6099 ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
6100 `(#:test-target "shellcheck"
6101 #:modules ((guix build gnu-build-system)
6102 (guix build utils)
6103 (srfi srfi-1))
6104 #:phases
6105 (modify-phases %standard-phases
6106 (delete 'configure) ; no configure script
6107 (add-before 'build 'setenv
6108 (lambda* (#:key outputs #:allow-other-keys)
6109 (let ((out (assoc-ref outputs "out")))
6110 (setenv "TLP_WITH_SYSTEMD" "0")
6111 (setenv "TLP_NO_INIT" "1")
6112 (setenv "TLP_NO_PMUTILS" "1")
6113 (setenv "TLP_SBIN" (string-append out "/bin"))
6114 (setenv "TLP_BIN" (string-append out "/bin"))
6115 (setenv "TLP_TLIB" (string-append out "/share/tlp"))
6116 (setenv "TLP_FLIB" (string-append out "/share/tlp/func.d"))
6117 (setenv "TLP_ULIB" (string-append out "/lib/udev"))
6118 (setenv "TLP_CONFDEF"
6119 (string-append out "/share/tlp/defaults.conf"))
6120 (setenv "TLP_CONFDIR" (string-append out "/etc/tlp.d"))
6121 (setenv "TLP_ELOD"
6122 (string-append out "/lib/elogind/system-sleep"))
6123 (setenv "TLP_SHCPL"
6124 (string-append out "/share/bash-completion/completions"))
6125 (setenv "TLP_MAN" (string-append out "/share/man"))
6126 (setenv "TLP_META" (string-append out "/share/metainfo"))
6127 #t)))
6128 (add-before 'install 'fix-installation
6129 (lambda _
6130 ;; Stop the Makefile from trying to create system directories.
6131 (substitute* "Makefile"
6132 (("\\[ -f \\$\\(_CONFUSR\\) \\]") "#")
6133 (("install -d -m 755 \\$\\(_VAR\\)") "#"))
6134 #t))
6135 (replace 'install
6136 (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
6137 (add-after 'install 'wrap
6138 (lambda* (#:key inputs outputs #:allow-other-keys)
6139 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
6140 (bin-files (find-files bin ".*")))
6141 (define (bin-directory input-name)
6142 (let ((p (assoc-ref inputs input-name)))
6143 (and p (string-append p "/bin"))))
6144 (define (sbin-directory input-name)
6145 (string-append (assoc-ref inputs input-name) "/sbin"))
6146 (for-each (lambda (program)
6147 (wrap-program program
6148 `("PATH" ":" prefix
6149 ,(append
6150 (filter-map bin-directory
6151 '("bash"
6152 "coreutils"
6153 "dbus"
6154 "eudev"
6155 "grep"
6156 "inetutils"
6157 "kmod"
6158 "perl"
6159 "sed"
6160 "usbutils"
6161 "util-linux"
6162 "x86-energy-perf-policy"))
6163 (filter-map sbin-directory
6164 '("ethtool"
6165 "hdparm"
6166 "iw"
6167 "pciutils"
6168 "rfkill"
6169 "wireless-tools"))))))
6170 bin-files)
6171 #t))))))
6172 (home-page "https://linrunner.de/en/tlp/tlp.html")
6173 (synopsis "Power management tool for Linux")
6174 (description "TLP is a power management tool for Linux. It comes with
6175 a default configuration already optimized for battery life. Nevertheless,
6176 TLP is customizable to fulfil system requirements. TLP settings are applied
6177 every time the power supply source is changed.")
6178 ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
6179 ;; rest is GPLv2+.
6180 (license (list license:gpl2+ license:gpl3+))))
6181
6182 (define-public lshw
6183 (package
6184 (name "lshw")
6185 (version "B.02.19.2")
6186 (source (origin
6187 (method url-fetch)
6188 (uri (string-append "https://www.ezix.org/software/"
6189 "files/lshw-" version
6190 ".tar.gz"))
6191 (sha256
6192 (base32
6193 "100gm1c6gb2hkfws22h0xhvv7nz38p49lxd1csikj8qlhyn4gcwv"))))
6194 (build-system gnu-build-system)
6195 (arguments
6196 `(#:phases (modify-phases %standard-phases (delete 'configure))
6197 #:tests? #f ; no tests
6198 #:make-flags
6199 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
6200 (synopsis "List hardware information")
6201 (description
6202 "@command{lshw} (Hardware Lister) is a small tool to provide
6203 detailed information on the hardware configuration of the machine.
6204 It can report exact memory configuration, firmware version, mainboard
6205 configuration, CPU version and speed, cache configuration, bus speed,
6206 and more on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
6207 machines (PowerMac G4 is known to work).")
6208 (home-page "https://www.ezix.org/project/wiki/HardwareLiSter")
6209 (license license:gpl2+)))
6210
6211 (define-public libmnl
6212 (package
6213 (name "libmnl")
6214 (version "1.0.4")
6215 (source
6216 (origin
6217 (method url-fetch)
6218 (uri (string-append "mirror://netfilter.org/libmnl/"
6219 "libmnl-" version ".tar.bz2"))
6220 (sha256
6221 (base32
6222 "108zampspaalv44zn0ar9h386dlfixpd149bnxa5hsi8kxlqj7qp"))))
6223 (build-system gnu-build-system)
6224 (home-page "https://www.netfilter.org/projects/libmnl/")
6225 (synopsis "Netlink utility library")
6226 (description "Libmnl is a minimalistic user-space library oriented to
6227 Netlink developers. There are a lot of common tasks in parsing, validating,
6228 constructing of both the Netlink header and TLVs that are repetitive and easy to
6229 get wrong. This library aims to provide simple helpers that allows you to
6230 re-use code and to avoid re-inventing the wheel.")
6231 (license license:lgpl2.1+)))
6232
6233 (define-public libnftnl
6234 (package
6235 (name "libnftnl")
6236 (version "1.1.7")
6237 (source
6238 (origin
6239 (method url-fetch)
6240 (uri (string-append "mirror://netfilter.org/libnftnl/"
6241 "libnftnl-" version ".tar.bz2"))
6242 (sha256
6243 (base32 "13zd90bfrr0q3j0l0cbc8kiizccw6n8gp727kqnfljh024zw3nr0"))))
6244 (build-system gnu-build-system)
6245 (native-inputs
6246 `(("pkg-config" ,pkg-config)))
6247 (inputs
6248 `(("libmnl" ,libmnl)))
6249 (home-page "https://www.netfilter.org/projects/libnftnl/index.html")
6250 (synopsis "Netlink programming interface to the Linux nf_tables subsystem")
6251 (description "Libnftnl is a userspace library providing a low-level netlink
6252 programming interface to the in-kernel nf_tables subsystem. The library
6253 libnftnl has been previously known as libnftables. This library is currently
6254 used by nftables.")
6255 (license license:gpl2+)))
6256
6257 (define-public nftables
6258 (package
6259 (name "nftables")
6260 (version "0.9.6")
6261 (source
6262 (origin
6263 (method url-fetch)
6264 (uri (list (string-append "mirror://netfilter.org/nftables/nftables-"
6265 version ".tar.bz2")
6266 (string-append "https://www.nftables.org/projects/nftables"
6267 "/files/nftables-" version ".tar.bz2")))
6268 (sha256
6269 (base32 "0vmn6xwqa1nq6crfxshh049b199d0aj6hfgin7k068xhibzgvmk8"))))
6270 (build-system gnu-build-system)
6271 (arguments `(#:configure-flags
6272 '("--disable-man-doc"))) ; FIXME: Needs docbook2x.
6273 (inputs `(("gmp" ,gmp)
6274 ("libmnl" ,libmnl)
6275 ("libnftnl" ,libnftnl)
6276 ("readline" ,readline)))
6277 (native-inputs `(("pkg-config" ,pkg-config)
6278 ("bison" ,bison)
6279 ("flex" ,flex)))
6280 (home-page "https://www.nftables.org")
6281 (synopsis "Userspace utility for Linux packet filtering")
6282 (description "nftables is the project that aims to replace the existing
6283 {ip,ip6,arp,eb}tables framework. Basically, this project provides a new packet
6284 filtering framework, a new userspace utility and also a compatibility layer for
6285 {ip,ip6}tables. nftables is built upon the building blocks of the Netfilter
6286 infrastructure such as the existing hooks, the connection tracking system, the
6287 userspace queueing component and the logging subsystem.")
6288 (license license:gpl2)))
6289
6290 (define-public proot
6291 (package
6292 (name "proot")
6293 (version "5.1.0")
6294 (source
6295 (origin
6296 (method git-fetch)
6297 (uri (git-reference
6298 (url "https://github.com/proot-me/PRoot")
6299 (commit (string-append "v" version))))
6300 (file-name (git-file-name name version))
6301 (sha256
6302 (base32 "0azsqis99gxldmbcg43girch85ysg4hwzf0h1b44bmapnsm89fbz"))
6303 (patches (search-patches "proot-test-fhs.patch"))))
6304 (build-system gnu-build-system)
6305 (arguments
6306 '(#:make-flags '("-C" "src")
6307
6308 #:phases (modify-phases %standard-phases
6309 (delete 'configure)
6310 (add-before 'build 'set-shell-file-name
6311 (lambda* (#:key inputs #:allow-other-keys)
6312 (substitute* (find-files "src" "\\.[ch]$")
6313 (("\"/bin/sh\"")
6314 (string-append "\""
6315 (assoc-ref inputs "bash")
6316 "/bin/sh\"")))
6317 #t))
6318 (add-before 'check 'fix-fhs-assumptions-in-tests
6319 (lambda _
6320 (substitute* "tests/test-c6b77b77.mk"
6321 (("/bin/bash") (which "bash"))
6322 (("/usr/bin/test") (which "test")))
6323 (substitute* '("tests/test-16573e73.c")
6324 (("/bin/([a-z-]+)" _ program)
6325 (which program)))
6326
6327 (substitute* (find-files "tests" "\\.sh$")
6328 ;; Some of the tests try to "bind-mount" /bin/true.
6329 (("-b /bin/true:")
6330 (string-append "-b " (which "true") ":"))
6331 ;; Likewise for /bin.
6332 (("-b /bin:") "-b /gnu:")
6333 ;; Others try to run /bin/sh.
6334 (("/bin/sh") (which "sh"))
6335 ;; Others assume /etc/fstab exists.
6336 (("/etc/fstab") "/etc/passwd"))
6337
6338 (substitute* "tests/GNUmakefile"
6339 (("-b /bin:") "-b /gnu:"))
6340
6341 ;; XXX: This test fails in an obscure corner case, just
6342 ;; skip it.
6343 (delete-file "tests/test-kkkkkkkk.c")
6344
6345 #t))
6346 (replace 'check
6347 (lambda _
6348 (let ((n (parallel-job-count)))
6349 ;; For some reason we get lots of segfaults with
6350 ;; seccomp support (x86_64, Linux-libre 4.11.0).
6351 (setenv "PROOT_NO_SECCOMP" "1")
6352
6353 ;; Most of the tests expect "/bin" to be in $PATH so
6354 ;; they can run things that live in $ROOTFS/bin.
6355 (setenv "PATH"
6356 (string-append (getenv "PATH") ":/bin"))
6357
6358 (invoke "make" "check" "-C" "tests"
6359 ;;"V=1"
6360 "-j" (number->string n)))))
6361 (replace 'install
6362 (lambda* (#:key outputs #:allow-other-keys)
6363 ;; The 'install' rule does nearly nothing.
6364 (let* ((out (assoc-ref outputs "out"))
6365 (man1 (string-append out "/share/man/man1")))
6366 ;; TODO: 'make install-care' (does not even
6367 ;; build currently.)
6368 (invoke "make" "-C" "src" "install"
6369 (string-append "PREFIX=" out))
6370
6371 (mkdir-p man1)
6372 (copy-file "doc/proot/man.1"
6373 (string-append man1 "/proot.1"))
6374 #t))))))
6375 (native-inputs `(("which" ,which)
6376
6377 ;; For 'mcookie', used by some of the tests.
6378 ("util-linux" ,util-linux)
6379
6380 ;; XXX: Choose the old coreutils because its 'stat'
6381 ;; program does not use statx(2) when running 'stat -c
6382 ;; %a' or similar, which PRoot doesn't properly support.
6383 ("coreutils-old" ,coreutils-8.30)
6384
6385 ;; XXX: 'test-c6b77b77.sh' runs 'make' and that leads
6386 ;; make 4.3 to segfault.
6387 ("make-old" ,gnu-make-4.2)))
6388 (inputs `(("talloc" ,talloc)))
6389 (home-page "https://github.com/proot-me/PRoot")
6390 (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
6391 (description
6392 "PRoot is a user-space implementation of @code{chroot}, @code{mount --bind},
6393 and @code{binfmt_misc}. This means that users don't need any privileges or
6394 setup to do things like using an arbitrary directory as the new root
6395 file system, making files accessible somewhere else in the file system
6396 hierarchy, or executing programs built for another CPU architecture
6397 transparently through QEMU user-mode. Also, developers can use PRoot as a
6398 generic process instrumentation engine thanks to its extension mechanism.
6399 Technically PRoot relies on @code{ptrace}, an unprivileged system-call
6400 available in the kernel Linux.")
6401 (license license:gpl2+)))
6402
6403 (define-public proot-static
6404 (package
6405 (inherit proot)
6406 (name "proot-static")
6407 (synopsis
6408 "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
6409 (inputs `(("talloc" ,talloc/static)))
6410 (arguments
6411 (substitute-keyword-arguments (package-arguments proot)
6412 ((#:make-flags flags)
6413 `(cons "LDFLAGS = -ltalloc -static -static-libgcc" ,flags))
6414 ((#:phases phases)
6415 `(modify-phases ,phases
6416 (add-after 'strip 'remove-store-references
6417 (lambda* (#:key outputs #:allow-other-keys)
6418 (let* ((out (assoc-ref outputs "out")))
6419 (with-directory-excursion out
6420 (remove-store-references "bin/proot")
6421 #t))))))
6422 ((#:allowed-references _ '("out"))
6423 '("out"))))))
6424
6425 (define-public cpuid
6426 (package
6427 (name "cpuid")
6428 (version "20200427")
6429 (source (origin
6430 (method url-fetch)
6431 (uri (string-append "http://www.etallen.com/cpuid/cpuid-"
6432 version ".src.tar.gz"))
6433 (sha256
6434 (base32
6435 "1m31238z2ya8f8pzpyklwp0ksf5xicqrw1z941hhhx913wzldaf1"))))
6436 (build-system gnu-build-system)
6437 (arguments
6438 '(#:make-flags '("CC=gcc")
6439 #:tests? #f ; no tests
6440 #:phases (modify-phases %standard-phases
6441 (delete 'configure) ; no configure script
6442 (add-before 'install 'fix-makefile
6443 (lambda* (#:key outputs #:allow-other-keys)
6444 (substitute* "Makefile"
6445 (("\\$\\(BUILDROOT\\)/usr") (assoc-ref outputs "out")))
6446 ;; Make the compressed manpages writable so that the
6447 ;; reset-gzip-timestamps phase does not error out.
6448 (substitute* "Makefile"
6449 (("-m 444") "-m 644"))
6450 #t)))))
6451 (inputs `(("perl" ,perl)))
6452 (supported-systems '("i686-linux" "x86_64-linux"))
6453 (home-page "http://www.etallen.com/cpuid.html")
6454 (synopsis "Linux tool to dump x86 CPUID information about the CPU(s)")
6455 (description "cpuid dumps detailed information about the CPU(s) gathered
6456 from the CPUID instruction, and also determines the exact model of CPU(s). It
6457 supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC,
6458 NexGen, Rise, and SiS CPUs.")
6459 (license license:gpl2+)))
6460
6461 (define-public jmtpfs
6462 (package
6463 (name "jmtpfs")
6464 (version "0.5")
6465 (source
6466 (origin
6467 (method git-fetch)
6468 (uri (git-reference
6469 (url "https://github.com/JasonFerrara/jmtpfs")
6470 (commit (string-append "v" version))))
6471 (file-name (git-file-name name version))
6472 (sha256
6473 (base32
6474 "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1"))))
6475 (build-system gnu-build-system)
6476 (inputs
6477 `(("file" ,file)
6478 ("fuse" ,fuse)
6479 ("libmtp" ,libmtp)))
6480 (native-inputs
6481 `(("pkg-config" ,pkg-config)))
6482 (home-page "https://github.com/JasonFerrara/jmtpfs")
6483 (synopsis "Use a FUSE file system to access data over MTP")
6484 (description "jmtpfs uses FUSE (file system in userspace) to provide access
6485 to data over the Media Transfer Protocol (MTP). Unprivileged users can mount
6486 the MTP device as a file system.")
6487 (license license:gpl3)))
6488
6489 (define-public procenv
6490 (package
6491 (name "procenv")
6492 (version "0.51")
6493 (source
6494 (origin
6495 (method git-fetch)
6496 (uri (git-reference
6497 (url "https://github.com/jamesodhunt/procenv")
6498 (commit version)))
6499 (file-name (git-file-name name version))
6500 (sha256
6501 (base32 "1ilrsw1rc85w29mkbkmm5n5w427gapv43yrjzvkb4kc9xhscgdjn"))))
6502 (build-system gnu-build-system)
6503 (arguments `(#:configure-flags '("--disable-silent-rules")))
6504 (native-inputs
6505 `(("pkg-config" ,pkg-config)
6506
6507 ;; For tests.
6508 ("check" ,check)
6509 ("groff" ,groff)))
6510 (inputs
6511 `(("expat" ,expat)
6512 ("libcap" ,libcap)
6513 ("libselinux" ,libselinux)))
6514 (synopsis "Utility to show process environment")
6515 (description "Procenv is a command-line tool that displays as much detail about
6516 itself and its environment as possible. It can be used as a test
6517 tool, to understand the type of environment a process runs in, and for
6518 comparing system environments.")
6519 (home-page "https://github.com/jamesodhunt/procenv/")
6520 (license license:gpl3+)))
6521
6522 (define-public libfabric
6523 (package
6524 (name "libfabric")
6525 (version "1.4.1")
6526 (source
6527 (origin
6528 (method url-fetch)
6529 (uri
6530 (string-append "https://github.com/ofiwg/libfabric/releases/download/v"
6531 version "/libfabric-" version ".tar.bz2"))
6532 (sha256
6533 (base32 "19l2m1frna1l765z4j7wl8hp4rb9wrh0hy5496685hd183hmy5pv"))))
6534 (build-system gnu-build-system)
6535 (inputs `(("rdma-core" ,rdma-core)
6536 ,@(match (%current-system)
6537 ((member (package-supported-systems psm))
6538 `(("psm" ,psm)))
6539 (_ `()))
6540 ("libnl" ,libnl)))
6541 (home-page "https://ofiwg.github.io/libfabric/")
6542 (synopsis "Open Fabric Interfaces")
6543 (description
6544 "OpenFabrics Interfaces (OFI) is a framework focused on exporting fabric
6545 communication services to applications. OFI is best described as a collection
6546 of libraries and applications used to export fabric services. The key
6547 components of OFI are: application interfaces, provider libraries, kernel
6548 services, daemons, and test applications.
6549
6550 Libfabric is a core component of OFI. It is the library that defines and
6551 exports the user-space API of OFI, and is typically the only software that
6552 applications deal with directly. It works in conjunction with provider
6553 libraries, which are often integrated directly into libfabric.")
6554 (license (list license:bsd-2 license:gpl2)))) ;dual
6555
6556 (define-public psm
6557 (package
6558 (name "psm")
6559 (version "3.3.20170428")
6560 (home-page "https://github.com/intel/psm")
6561 (source
6562 (origin
6563 (method git-fetch)
6564 (uri (git-reference (url home-page)
6565 (commit "604758e76dc31e68d1de736ccf5ddf16cb22355b")))
6566 (file-name (string-append "psm-" version ".tar.gz"))
6567 (sha256
6568 (base32 "0nsb325dmhn5ia3d2cnksqr0gdvrrx2hmvlylfgvmaqdpq76zm85"))
6569 (patches (search-patches
6570 "psm-arch.patch" ; uname -p returns "unknown" on Debian 9
6571 "psm-ldflags.patch" ; build shared lib with LDFLAGS
6572 "psm-repro.patch" ; reproducibility
6573 "psm-disable-memory-stats.patch"))))
6574 (build-system gnu-build-system)
6575 (outputs '("out" "debug"))
6576 (inputs `(("libuuid" ,util-linux "lib")))
6577 (arguments
6578 '(#:make-flags `("PSM_USE_SYS_UUID=1" "CC=gcc" "WERROR="
6579 ,(string-append "INSTALL_PREFIX=" %output)
6580 ,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
6581 #:tests? #f
6582 #:phases (modify-phases %standard-phases
6583 (delete 'configure)
6584 (add-after 'unpack 'patch-/usr/include
6585 (lambda _
6586 (substitute* "Makefile"
6587 (("\\$\\{DESTDIR}/usr/include")
6588 (string-append %output "/include")))
6589 (substitute* "Makefile"
6590 (("/lib64") "/lib"))
6591 #t))
6592 (add-after 'unpack 'patch-sysmacros
6593 (lambda _
6594 (substitute* "ipath/ipath_proto.c"
6595 (("#include <sys/poll.h>" m)
6596 (string-append m "\n"
6597 "#include <sys/sysmacros.h>")))
6598 #t)))))
6599 (synopsis "Intel Performance Scaled Messaging (PSM) Libraries")
6600 (description
6601 "The PSM Messaging API, or PSM API, is Intel's low-level user-level
6602 communications interface for the True Scale family of products. PSM users are
6603 enabled with mechanisms necessary to implement higher level communications
6604 interfaces in parallel environments.")
6605 ;; Only Intel-compatable processors are supported.
6606 (supported-systems '("i686-linux" "x86_64-linux"))
6607 (license (list license:bsd-2 license:gpl2)))) ;dual
6608
6609 (define-public snapscreenshot
6610 (package
6611 (name "snapscreenshot")
6612 (version "1.0.14.3")
6613 (source
6614 (origin
6615 (method url-fetch)
6616 (uri (string-append "http://bisqwit.iki.fi/src/arch/"
6617 name "-" version ".tar.bz2"))
6618 (sha256
6619 (base32 "0gzvqsbf6a2sbd1mqvj1lbm57i2bm5k0cr6ncr821d1f32gw03mk"))))
6620 (build-system gnu-build-system)
6621 (arguments
6622 `(#:make-flags
6623 (let ((out (assoc-ref %outputs "out")))
6624 (list (string-append "BINDIR=" out "/bin")
6625 (string-append "MANDIR=" out "/share/man")))
6626 #:tests? #f ; no test suite
6627 #:phases
6628 (modify-phases %standard-phases
6629 (delete 'configure) ; ./configure is a snarky no-op
6630 (add-before 'install 'fix-ownership
6631 ;; Install binaries owned by ‘root’ instead of the nonexistent ‘bin’.
6632 (lambda _
6633 (substitute* "depfun.mak"
6634 ((" -o bin -g bin ") " "))
6635 #t))
6636 (add-before 'install 'create-output-directories
6637 (lambda* (#:key outputs #:allow-other-keys)
6638 (let ((out (assoc-ref outputs "out")))
6639 (mkdir-p (string-append out "/share/man/man1"))
6640 #t))))))
6641 (home-page "https://bisqwit.iki.fi/source/snapscreenshot.html")
6642 (synopsis "Take screenshots of one or more Linux text consoles")
6643 (description
6644 "snapscreenshot saves a screenshot of one or more Linux text consoles as a
6645 Targa (@dfn{.tga}) image. It can be used by anyone with read access to the
6646 relevant @file{/dev/vcs*} file(s).")
6647 (license license:gpl2)))
6648
6649 (define-public fbcat
6650 (package
6651 (name "fbcat")
6652 (version "0.5.1")
6653 (source
6654 (origin
6655 (method url-fetch)
6656 (uri (string-append "https://github.com/jwilk/fbcat/releases/download/"
6657 version "/" name "-" version ".tar.gz"))
6658 (sha256
6659 (base32 "0pj9hxmwhbz6kmd7847yx2jh1scl9l25zgndyi8s9vlzdkq2q8d7"))))
6660 (build-system gnu-build-system)
6661 (inputs
6662 ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters. We
6663 ;; choose netpbm simply because it's the smallest. It still adds ~94 MiB
6664 ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
6665 `(("pnmtopng" ,netpbm)))
6666 (outputs (list "out" "fbgrab"))
6667 (arguments
6668 `(#:make-flags
6669 (list "CC=gcc"
6670 (string-append "PREFIX=" (assoc-ref %outputs "out")))
6671 #:tests? #f ; no tests
6672 #:phases
6673 (modify-phases %standard-phases
6674 (delete 'configure) ; no configure script
6675 (add-after 'build 'qualify-references
6676 (lambda* (#:key inputs outputs #:allow-other-keys)
6677 (let* ((pnmtopng (assoc-ref inputs "pnmtopng"))
6678 (out (assoc-ref outputs "out")))
6679 (substitute* "fbgrab"
6680 (("fbcat" all)
6681 (string-append out "/bin/" all))
6682 (("pnmtopng" all)
6683 (string-append pnmtopng "/bin/" all)))
6684 #t)))
6685 (add-after 'install 'split-fbgrab-output
6686 (lambda* (#:key outputs #:allow-other-keys)
6687 (let* ((out (assoc-ref outputs "out"))
6688 (out:fbgrab (assoc-ref outputs "fbgrab")))
6689 (for-each (lambda (file)
6690 (let ((old (string-append out "/" file))
6691 (new (string-append out:fbgrab "/" file)))
6692 (mkdir-p (dirname new))
6693 (rename-file old new)))
6694 (list "bin/fbgrab"
6695 "share/man/man1/fbgrab.1"))
6696 #t))))))
6697 (home-page "https://jwilk.net/software/fbcat")
6698 (synopsis "Take a screenshot of the contents of the Linux framebuffer")
6699 (description
6700 "fbcat saves the contents of the Linux framebuffer (@file{/dev/fb*}), or
6701 a dump therof. It supports a wide range of drivers and pixel formats.
6702 @command{fbcat} can take screenshots of virtually any application that can be
6703 made to write its output to the framebuffer, including (but not limited to)
6704 text-mode or graphical applications that don't use a display server.
6705
6706 Also included is @command{fbgrab}, a wrapper around @command{fbcat} that
6707 emulates the behaviour of Gunnar Monell's older fbgrab utility.")
6708 (license license:gpl2)))
6709
6710 (define-public libcgroup
6711 (package
6712 (name "libcgroup")
6713 (version "0.41")
6714 (source
6715 (origin
6716 (method url-fetch)
6717 (uri (string-append
6718 "mirror://sourceforge/libcg/" name "/"
6719 version "/" name "-" version ".tar.bz2"))
6720 (sha256
6721 (base32 "0lgvyq37gq84sk30sg18admxaj0j0p5dq3bl6g74a1ppgvf8pqz4"))))
6722 (build-system gnu-build-system)
6723 (arguments
6724 `(#:tests? #f))
6725 (native-inputs
6726 `(("bison" ,bison)
6727 ("flex" ,flex)))
6728 (inputs
6729 `(("linux-pam" ,linux-pam)))
6730 (home-page "https://sourceforge.net/projects/libcg/")
6731 (synopsis "Control groups management tools")
6732 (description "Control groups is Linux kernel method for process resource
6733 restriction, permission handling and more. This package provides userspace
6734 interface to this kernel feature.")
6735 (license license:lgpl2.1)))
6736
6737 (define-public mbpfan
6738 (package
6739 (name "mbpfan")
6740 (version "2.1.1")
6741 (source
6742 (origin
6743 (method git-fetch)
6744 (uri (git-reference
6745 (url "https://github.com/dgraziotin/mbpfan")
6746 (commit (string-append "v" version))))
6747 (file-name (git-file-name name version))
6748 (sha256
6749 (base32 "0aijyxrqh01x0s80yr4cgxgd001iiqqph65pxvby7f0wz8lnxnqj"))))
6750 (build-system gnu-build-system)
6751 (arguments
6752 `(#:tests? #f ; tests ask to be run as root
6753 #:make-flags (let ((out (assoc-ref %outputs "out")))
6754 (list (string-append "DESTDIR=" out)
6755 ,(string-append "CC=" (cc-for-target))))
6756 #:phases
6757 (modify-phases %standard-phases
6758 (add-after 'unpack 'patch-paths
6759 (lambda _
6760 (substitute* "Makefile"
6761 (("/usr") ""))
6762 #t))
6763 (delete 'configure)))) ; there's no configure phase
6764 (home-page "https://github.com/dgraziotin/mbpfan")
6765 (synopsis "Control fan speed on Macbooks")
6766 (description
6767 "mbpfan is a fan control daemon for Apple Macbooks. It uses input from
6768 the @code{coretemp} module and sets the fan speed using the @code{applesmc}
6769 module. It can be executed as a daemon or in the foreground with root
6770 privileges.")
6771 (license license:gpl3+)))
6772
6773 (define-public psm2
6774 (package
6775 (name "psm2")
6776 (version "11.2.86")
6777 (source (origin
6778 (method git-fetch)
6779 (uri (git-reference
6780 (url "https://github.com/intel/opa-psm2")
6781 (commit (string-append "PSM2_" version))))
6782 (file-name (git-file-name name version))
6783 (sha256
6784 (base32
6785 "1hiqzcmc97lzhaqjva82vf8irgg038cciypsv2brw90ak09n6vwf"))))
6786 (build-system gnu-build-system)
6787 (arguments
6788 '(#:make-flags
6789 `(,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
6790 #:tests? #f
6791 #:phases (modify-phases %standard-phases
6792 (delete 'configure)
6793 (add-after 'unpack 'patch-Makefiles
6794 (lambda _
6795 (substitute* "Makefile"
6796 (("/lib64") "/lib")
6797 (("/usr") ""))
6798 (substitute* "compat/Makefile"
6799 (("/lib64") "/lib")
6800 (("/usr") ""))
6801 #t))
6802 (replace 'install
6803 (lambda _
6804 (setenv "DESTDIR" %output)
6805 (invoke "make" "install")
6806 #t)))))
6807 (inputs
6808 `(("rdma-core" ,rdma-core)
6809 ("numactl" ,numactl)))
6810 (synopsis "Intel Performance Scaled Messaging 2 (PSM2) library")
6811 (description
6812 "This package is low-level user-level Intel's communications interface.
6813 The PSM2 API is a high-performance vendor-specific protocol that provides a
6814 low-level communications interface for the Intel Omni-Path family of
6815 high-speed networking devices.")
6816 (home-page "https://github.com/intel/opa-psm2")
6817 ;; Only the x86_64 architecure is supported.
6818 (supported-systems '("x86_64-linux"))
6819 (license (list license:bsd-3 license:gpl2)))) ; dual
6820
6821 (define-public libpfm4
6822 (package
6823 (name "libpfm4")
6824 (version "4.9.0")
6825 (source (origin
6826 (method url-fetch)
6827 (uri (string-append "mirror://sourceforge/perfmon2/"
6828 name "/libpfm-" version ".tar.gz"))
6829 (sha256
6830 (base32
6831 "1qp4g4n6dw42p2w5rkwzdb7ynk8h7g5vg01ybpmvxncgwa7bw3yv"))))
6832 (build-system gnu-build-system)
6833 (arguments
6834 '(#:modules ((guix build utils)
6835 (guix build gnu-build-system))
6836 #:phases (modify-phases %standard-phases
6837 (delete 'configure)
6838 (delete 'check)
6839 (replace 'build
6840 (lambda* (#:key inputs outputs #:allow-other-keys)
6841 (let* ((out (assoc-ref outputs "out")))
6842 (setenv "CC" "gcc")
6843 (invoke "make")
6844 #t)))
6845 (replace 'install
6846 (lambda* (#:key outputs #:allow-other-keys)
6847 (let* ((out (assoc-ref outputs "out")))
6848 (invoke "make"
6849 (string-append "PREFIX=" out)
6850 "install")
6851 #t))))))
6852 (synopsis "Performance event monitoring library")
6853 (description
6854 "This package provides a library called libpfm4, which is used to develop
6855 monitoring tools exploiting the performance monitoring events such as those
6856 provided by the Performance Monitoring Unit (PMU) of modern processors.
6857
6858 Libpfm4 helps convert from an event name, expressed as a string, to the event
6859 encoding that is either the raw event as documented by the hardware vendor or
6860 the OS-specific encoding. In the latter case, the library is able to prepare
6861 the OS-specific data structures needed by the kernel to setup the event.
6862
6863 libpfm4 provides support for the @code{perf_events} interface, which was
6864 introduced in Linux 2.6.31.")
6865 (home-page "http://perfmon2.sourceforge.net/")
6866 (license license:expat)))
6867
6868 (define-public libnfnetlink
6869 (package
6870 (name "libnfnetlink")
6871 (version "1.0.1")
6872 (source (origin
6873 (method url-fetch)
6874 (uri (string-append
6875 "https://www.netfilter.org/projects/libnfnetlink/files/"
6876 "libnfnetlink-" version ".tar.bz2"))
6877 (sha256
6878 (base32
6879 "06mm2x4b01k3m7wnrxblk9j0mybyr4pfz28ml7944xhjx6fy2w7j"))))
6880 (build-system gnu-build-system)
6881 (home-page "https://www.netfilter.org/projects/libnfnetlink/")
6882 (synopsis "Low-level netfilter netlink communication library")
6883 (description
6884 "@code{libnfnetlink} is the low-level library for netfilter related
6885 kernel/userspace communication. It provides a generic messaging
6886 infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log,
6887 nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
6888 management tools in userspace.")
6889 (license license:gpl2)))
6890
6891 (define-public go-netlink
6892 (package
6893 (name "go-netlink")
6894 (version "1.0.0")
6895 (source (origin
6896 (method git-fetch)
6897 (uri (git-reference
6898 (url "https://github.com/vishvananda/netlink")
6899 (commit (string-append "v" version))))
6900 (file-name (git-file-name name version))
6901 (sha256
6902 (base32
6903 "0hpzghf1a4cwawzhkiwdzin80h6hd09fskl77d5ppgc084yvj8x0"))))
6904 (build-system go-build-system)
6905 (arguments
6906 `(#:import-path "github.com/vishvananda/netlink"))
6907 (native-inputs
6908 `(("go-golang-org-x-sys" ,go-golang-org-x-sys)
6909 ("go-netns" ,go-netns)))
6910 (home-page "https://github.com/vishvananda/netlink")
6911 (synopsis "Simple netlink library for Go")
6912 (description "The netlink package provides a simple netlink library for
6913 Go. Netlink is the interface a user-space program in Linux uses to
6914 communicate with the kernel. It can be used to add and remove interfaces, set
6915 IP addresses and routes, and configure IPsec.")
6916 (license license:asl2.0)))
6917
6918 (define-public xfsprogs
6919 (package
6920 (name "xfsprogs")
6921 (version "5.7.0")
6922 (source (origin
6923 (method url-fetch)
6924 (uri (string-append
6925 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
6926 "xfsprogs-" version ".tar.gz"))
6927 (sha256
6928 (base32
6929 "0bssrfhnw5mhybgaa6d8wp87izi3c9cjpjy7vicm6y76mf7kl8p9"))))
6930 (build-system gnu-build-system)
6931 (outputs (list "out" "python"))
6932 (arguments
6933 `(#:tests? #f ; kernel/user integration tests are in package "xfstests"
6934 #:phases
6935 (modify-phases %standard-phases
6936 (add-after 'install 'separate-python-output
6937 (lambda* (#:key outputs #:allow-other-keys)
6938 (let ((out (assoc-ref outputs "out"))
6939 (python (assoc-ref outputs "python")))
6940 (for-each
6941 (lambda (script)
6942 (mkdir-p (string-append python (dirname script)))
6943 (rename-file (string-append out script)
6944 (string-append python script)))
6945 (list "/sbin/xfs_scrub_all"))
6946 #t)))
6947 (add-after 'install 'install-headers
6948 (lambda _
6949 (invoke "make" "install-dev"))))))
6950 (native-inputs
6951 `(("gettext" ,gettext-minimal)))
6952 (inputs
6953 `(("libuuid" ,util-linux "lib")
6954 ("python" ,python-wrapper)))
6955 (home-page "https://xfs.wiki.kernel.org/")
6956 (synopsis "XFS file system tools")
6957 (description "This package provides commands to create and check XFS
6958 file systems.")
6959 ;; The library "libhandle" and the headers in "xfslibs-dev" are
6960 ;; licensed under lgpl2.1. the other stuff is licensed under gpl2.
6961 (license (list license:gpl2 license:lgpl2.1))))
6962
6963 (define-public genext2fs
6964 (package
6965 (name "genext2fs")
6966 (version "1.4.1-4")
6967 (source (origin
6968 (method git-fetch)
6969 (uri (git-reference
6970 (url "https://github.com/jeremie-koenig/genext2fs")
6971 ;; 1.4.1-3 had a VCS tag but 1.4.1-4 doesn't.
6972 (commit "9ee43894634998b0b2b309d636f25c64314c9421")))
6973 (file-name (git-file-name name version))
6974 (sha256
6975 (base32 "0ib5icn78ciz00zhc1bgdlrwaxvsdz7wnplwblng0jirwi9ml7sq"))))
6976 (build-system gnu-build-system)
6977 (arguments
6978 `(#:phases
6979 (modify-phases %standard-phases
6980 (add-after 'unpack 'apply-debian-patches
6981 ;; Debian changes (the revision after ‘-’ in VERSION) are
6982 ;; maintained as separate patches. Apply those relevant to us.
6983 (lambda _
6984 (for-each
6985 (lambda (file-name)
6986 (invoke "patch" "-p1" "-i"
6987 (string-append "debian/patches/" file-name)))
6988 (list "blocksize+creator.diff" ; add -B/-o options
6989 "byteswap_fix.diff"))
6990 #t)))))
6991 (native-inputs
6992 `(("autoconf" ,autoconf)
6993 ("automake" ,automake)))
6994 (home-page "https://github.com/jeremie-koenig/genext2fs")
6995 (synopsis "Generate ext2 file system as a normal user")
6996 (description "This package provides a program to generate an ext2
6997 file system as a normal (non-root) user. It does not require you to mount
6998 the image file to copy files on it, nor does it require that you become
6999 the superuser to make device nodes.")
7000 (license license:gpl2)))
7001
7002 (define-public fakeroot
7003 (package
7004 (name "fakeroot")
7005 (version "1.24")
7006 (source (origin
7007 (method url-fetch)
7008 (uri (string-append "https://deb.debian.org/debian/pool/main/f/"
7009 "fakeroot/fakeroot_" version ".orig.tar.gz"))
7010 (file-name (string-append name "-" version ".tar.gz"))
7011 (sha256
7012 (base32
7013 "1vb6f93hjyqnwx8dc8mm3dgma7axgqk8s7sdsjs8l2rpc0qmn11f"))))
7014 (build-system gnu-build-system)
7015 (arguments
7016 `(#:phases
7017 (modify-phases %standard-phases
7018 (add-after 'configure 'patch-Makefile
7019 (lambda _
7020 ;; Note: The root of the problem is already in "Makefile.am".
7021 (substitute* "Makefile"
7022 (("/bin/sh") (which "sh")))
7023 #t))
7024 (add-after 'unpack 'patch-script
7025 (lambda* (#:key inputs #:allow-other-keys)
7026 (substitute* "scripts/fakeroot.in"
7027 (("getopt")
7028 (string-append (assoc-ref inputs "util-linux")
7029 "/bin/getopt"))
7030 (("sed")
7031 (string-append (assoc-ref inputs "sed")
7032 "/bin/sed"))
7033 (("cut")
7034 (string-append (assoc-ref inputs "coreutils")
7035 "/bin/cut")) )
7036 #t))
7037 (add-before 'configure 'setenv
7038 (lambda _
7039 (setenv "LIBS" "-lacl")
7040 #t))
7041 (add-before 'check 'prepare-check
7042 (lambda _
7043 (setenv "SHELL" (which "bash"))
7044 (setenv "VERBOSE" "1")
7045 (substitute* "test/t.touchinstall"
7046 ;; We don't have the name of the root user, so use ID=0.
7047 (("grep root") "grep \"\\<0\\>\""))
7048 (substitute* "test/tartest"
7049 ;; We don't have the name of the root group, so use ID=0.
7050 (("ROOTGROUP=root") "ROOTGROUP=0")
7051 ;; We don't have the name of the daemon user, so use IDs.
7052 (("daemon:sys") "1:3")
7053 (("daemon:") "1:"))
7054 ;; We don't have an /etc/passwd entry for "root" - use numeric IDs.
7055 (substitute* "test/compare-tar"
7056 (("tar -tvf") "tar --numeric-owner -tvf"))
7057
7058 ;; coreutils 8.32 changed 'ls' to use the statx() syscall instead
7059 ;; of lstat(). fakeroot 1.24 does not support the former, so
7060 ;; adjust these tests to use 'test -b' instead of 'ls' to test for
7061 ;; block device. See <https://bugs.gnu.org/41090>.
7062 (substitute* '("test/t.mknod" "test/t.chmod_dev")
7063 (("ls -ld? \\$tmp/hda3")
7064 "test -b $tmp/hda3 && echo block || echo fail"))
7065 #t)))))
7066 (native-inputs
7067 `(("acl" ,acl)
7068 ("sharutils" ,sharutils) ; for the tests
7069 ("xz" ,xz))) ; for the tests
7070 (inputs
7071 `(("libcap" ,libcap/next)
7072 ("util-linux" ,util-linux)
7073 ("sed" ,sed)
7074 ("coreutils" ,coreutils)))
7075 (synopsis "Provides a fake root environment")
7076 (description "@command{fakeroot} runs a command in an environment where
7077 it appears to have root privileges for file manipulation. This is useful
7078 for allowing users to create archives (tar, ar, .deb etc.) with files in
7079 them with root permissions/ownership. Without fakeroot one would have to
7080 have root privileges to create the constituent files of the archives with
7081 the correct permissions and ownership, and then pack them up, or one would
7082 have to construct the archives directly, without using the archiver.")
7083 (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
7084 (license license:gpl3+)))
7085
7086 (define-public fakechroot
7087 (package
7088 (name "fakechroot")
7089 (version "2.20.1")
7090 (source (origin
7091 (method url-fetch)
7092 (uri (string-append
7093 "https://github.com/dex4er/fakechroot/releases/download/"
7094 version "/fakechroot-" version ".tar.gz"))
7095 (sha256
7096 (base32
7097 "1aijkd0b45wav25v01qhw8zxwa3pl0nnp9fabmmy1nlx7hr09gas"))))
7098 (build-system gnu-build-system)
7099 (arguments
7100 ;; XXX: The tests heavily assume they run on an FHS system so for now
7101 ;; skip them.
7102 '(#:tests? #f
7103 #:configure-flags '("--disable-static")))
7104 (synopsis "Emulate @code{chroot} by overriding file system calls")
7105 (description
7106 "@command{fakechroot} runs a command in an environment were is additional
7107 possibility to use @code{chroot} command without root privileges. This is
7108 useful for allowing users to create own chrooted environment with possibility
7109 to install another packages without need for root privileges.
7110
7111 It works by providing @file{libfakechroot.so}, a shared library meant to be
7112 set as @code{LD_PRELOAD} to override the C library file system functions.")
7113 (home-page "https://github.com/dex4er/fakechroot/")
7114 (license license:lgpl2.1+)))
7115
7116 (define-public inputattach
7117 (package
7118 (name "inputattach")
7119 (version "0.42.0")
7120 (source (origin
7121 (method git-fetch)
7122 (uri (git-reference
7123 (url "https://github.com/linuxwacom/input-wacom")
7124 (commit (string-append "input-wacom-" version))))
7125 (file-name (git-file-name name version))
7126 (sha256
7127 (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
7128 (build-system gnu-build-system)
7129 (arguments
7130 `(#:phases
7131 (modify-phases %standard-phases
7132 (delete 'bootstrap)
7133 (delete 'configure)
7134 (replace 'build
7135 (lambda* (#:key inputs #:allow-other-keys)
7136 (with-directory-excursion "inputattach"
7137 (invoke (string-append (assoc-ref inputs "gcc")
7138 "/bin/gcc")
7139 "-O2" "-o" "inputattach" "inputattach.c"))
7140 #t))
7141 (delete 'check)
7142 (replace 'install
7143 (lambda* (#:key outputs #:allow-other-keys)
7144 (let ((target-dir (string-append
7145 (assoc-ref outputs "out")
7146 "/bin/")))
7147 (mkdir-p target-dir)
7148 (copy-file "inputattach/inputattach"
7149 (string-append target-dir
7150 "inputattach"))
7151 #t))))))
7152 (home-page "https://linuxwacom.github.io/")
7153 (synopsis "Dispatch input peripherals events to a device file")
7154 (description "inputattach dispatches input events from several device
7155 types and interfaces and translates so that the X server can use them.")
7156 (license license:gpl2+)))
7157
7158 (define-public pipewire
7159 (package
7160 (name "pipewire")
7161 (version "0.2.7")
7162 (source (origin
7163 (method git-fetch)
7164 (uri (git-reference
7165 (url "https://github.com/PipeWire/pipewire")
7166 (commit version)))
7167 (file-name (git-file-name name version))
7168 (sha256
7169 (base32
7170 "1q5wrqnhhs6r49p8yvkw1pl0cnsd4rndxy4h5lvdydwgf1civcwc"))))
7171 (build-system meson-build-system)
7172 (arguments
7173 '(#:configure-flags '("-Dsystemd=false")))
7174 (native-inputs
7175 `(("pkg-config" ,pkg-config)))
7176 (inputs
7177 `(("alsa-lib" ,alsa-lib)
7178 ("dbus" ,dbus)
7179 ("eudev" ,eudev)
7180 ("ffmpeg" ,ffmpeg)
7181 ("gstreamer" ,gstreamer)
7182 ("gst-plugins-base" ,gst-plugins-base)
7183 ("libva" ,libva)
7184 ("sbc" ,sbc)
7185 ("sdl2" ,sdl2)))
7186 (home-page "https://pipewire.org/")
7187 (synopsis "Server and user space API to deal with multimedia pipelines")
7188 (description
7189 "PipeWire is a project that aims to greatly improve handling of audio and
7190 video under Linux. It aims to support the usecases currently handled by both
7191 PulseAudio and Jack and at the same time provide same level of powerful handling
7192 of Video input and output. It also introduces a security model that makes
7193 interacting with audio and video devices from containerized applications easy,
7194 with supporting Flatpak applications being the primary goal. Alongside Wayland
7195 and Flatpak we expect PipeWire to provide a core building block for the future
7196 of Linux application development.")
7197 (license license:lgpl2.0+)))
7198
7199 (define-public pipewire-0.3
7200 (package
7201 (inherit pipewire)
7202 (name "pipewire")
7203 (version "0.3.10")
7204 (source (origin
7205 (method git-fetch)
7206 (uri (git-reference
7207 (url "https://github.com/PipeWire/pipewire")
7208 (commit version)))
7209 (file-name (git-file-name name version))
7210 (sha256
7211 (base32
7212 "1y293sfhhmzbgnlvs46bpiyimlii5nk71f8115qxs8sviwlsdr3w"))))
7213 (arguments
7214 '(#:configure-flags
7215 (list (string-append "-Dudevrulesdir=" (assoc-ref %outputs "out")
7216 "/lib/udev/rules.d")
7217 "-Dsystemd=false")
7218 #:phases
7219 (modify-phases %standard-phases
7220 ;; Skip shrink-runpath, otherwise validate-runpath fails.
7221 (delete 'shrink-runpath))))
7222 (inputs
7223 (append (package-inputs pipewire)
7224 `(("bluez" ,bluez)
7225 ("jack" ,jack-2)
7226 ("pulseaudio" ,pulseaudio)
7227 ("vulkan-loader" ,vulkan-loader)
7228 ("vulkan-headers" ,vulkan-headers))))))
7229
7230 (define-public ell
7231 (package
7232 (name "ell")
7233 (version "0.23")
7234 (source (origin
7235 (method git-fetch)
7236 (uri (git-reference
7237 (url "https://git.kernel.org/pub/scm/libs/ell/ell.git")
7238 (commit version)))
7239 (file-name (git-file-name name version))
7240 (sha256
7241 (base32
7242 "1qhlcwhn0gj877yss2ymx1aczghlddzb5v9mm1dgp2zliii3jy10"))))
7243 (build-system gnu-build-system)
7244 (arguments
7245 `(#:phases
7246 (modify-phases %standard-phases
7247 (add-after 'unpack 'fix-dbus-tests
7248 (lambda _
7249 (substitute* '("unit/test-dbus-message-fds.c"
7250 "unit/test-dbus-properties.c"
7251 "unit/test-dbus.c")
7252 (("/usr/bin/dbus-daemon") (which "dbus-daemon")))
7253 #t)))))
7254 (inputs
7255 `(("dbus" ,dbus)))
7256 (native-inputs
7257 `(("autoconf" ,autoconf)
7258 ("libtool" ,libtool)
7259 ("pkgconfig" ,pkg-config)
7260 ("automake" ,automake)))
7261 (home-page "https://01.org/ell")
7262 (synopsis "Embedded Linux Library")
7263 (description "The Embedded Linux* Library (ELL) provides core, low-level
7264 functionality for system daemons. It typically has no dependencies other than
7265 the Linux kernel, C standard library, and libdl (for dynamic linking). While
7266 ELL is designed to be efficient and compact enough for use on embedded Linux
7267 platforms, it is not limited to resource-constrained systems.")
7268 (license license:lgpl2.1+)))
7269
7270 (define-public lttng-ust
7271 (package
7272 (name "lttng-ust")
7273 (version "2.11.0")
7274 (source (origin
7275 (method url-fetch)
7276 (uri (string-append "https://lttng.org/files/lttng-ust/"
7277 "lttng-ust-" version ".tar.bz2"))
7278 (sha256
7279 (base32
7280 "1n646yz7882svf5a4ay3vqiiz3qjn3pgkkij9kk22871wp7q0ck8"))))
7281 (build-system gnu-build-system)
7282 (inputs
7283 `(("liburcu" ,liburcu)
7284 ("numactl" ,numactl)))
7285 (native-inputs
7286 `(("python" ,python-3)))
7287 (home-page "https://lttng.org/")
7288 (synopsis "LTTng userspace tracer libraries")
7289 (description "The user space tracing library, liblttng-ust, is the LTTng
7290 user space tracer. It receives commands from a session daemon, for example to
7291 enable and disable specific instrumentation points, and writes event records
7292 to ring buffers shared with a consumer daemon.")
7293 (license license:lgpl2.1+)))
7294
7295 (define-public kexec-tools
7296 (package
7297 (name "kexec-tools")
7298 (version "2.0.20")
7299 (source (origin
7300 (method url-fetch)
7301 (uri (string-append "mirror://kernel.org/linux/utils/kernel"
7302 "/kexec/kexec-tools-" version ".tar.xz"))
7303 (sha256
7304 (base32
7305 "1j7qlhxk1rbv9jbj8wd6hb7zl8p2mp29ymrmccgmsi0m0dzhgn6s"))))
7306 (build-system gnu-build-system)
7307 (arguments
7308 ;; There are no automated tests.
7309 '(#:tests? #f))
7310 (home-page "https://projects.horms.net/projects/kexec/")
7311 (synopsis "Tools for booting directly into different kernels")
7312 (description "This package provides the @code{kexec} program and ancillary
7313 utilities. Using @code{kexec}, it is possible to boot directly into a new
7314 kernel from the context of an already-running kernel, bypassing the normal
7315 system boot process.")
7316 (license license:gpl2)))
7317
7318 (define-public cachefilesd
7319 (package
7320 (name "cachefilesd")
7321 (version "0.10.10")
7322 (source (origin
7323 (method url-fetch)
7324 (uri (string-append
7325 "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells"
7326 "/cachefilesd.git/snapshot/cachefilesd-"
7327 version ".tar.gz"))
7328 (sha256
7329 (base32
7330 "0g40ljjnn3wzh9gp6il21c95f977298qrrkrxfnwfl3k3asfmnbi"))))
7331 (build-system gnu-build-system)
7332 (outputs '("out"))
7333 (arguments
7334 `(#:tests? #f ; there are no tests
7335 #:make-flags
7336 (let ((prefix-dir (lambda (var dir)
7337 (string-append var "=" %output "/" dir))))
7338 (list (string-append "CC=" ,(cc-for-target))
7339 (prefix-dir "SBINDIR" "sbin/")
7340 (prefix-dir "ETCDIR" "etc/")
7341 (prefix-dir "MANDIR" "share/man/")))
7342 #:phases (modify-phases %standard-phases (delete 'configure))))
7343 (home-page "https://people.redhat.com/~dhowells/cachefs/")
7344 (synopsis "CacheFiles userspace management daemon")
7345 (description "@code{cachefilesd} is a userspace daemon that manages the
7346 cache data store that is used by network file systems such as @code{AFS} and
7347 @code{NFS} to cache data locally on disk. The content of the cache is
7348 persistent over reboots.")
7349 (license license:gpl2+)))
7350
7351 (define-public libbpf
7352 (package
7353 (name "libbpf")
7354 (version "0.0.9")
7355 (source
7356 (origin
7357 (method git-fetch)
7358 (uri (git-reference
7359 (url "https://github.com/libbpf/libbpf")
7360 (commit (string-append "v" version))))
7361 (file-name (git-file-name name version))
7362 (sha256
7363 (base32
7364 "18l0gff7nm841mwhr7bc7x863xcyvwh58zl7mc0amnsjqlbrvqg7"))))
7365 (build-system gnu-build-system)
7366 (native-inputs
7367 `(("pkg-config" ,pkg-config)))
7368 (inputs
7369 `(("libelf" ,libelf)
7370 ("zlib" ,zlib)))
7371 (arguments
7372 `(#:tests? #f ; No tests
7373 #:make-flags
7374 (list
7375 (string-append "PREFIX=''")
7376 (string-append "DESTDIR=" (assoc-ref %outputs "out"))
7377 (string-append "LIBDIR=/lib")
7378 (string-append
7379 "CC=" (assoc-ref %build-inputs "gcc") "/bin/gcc"))
7380 #:phases
7381 (modify-phases %standard-phases
7382 (delete 'configure)
7383 (add-before 'build 'pre-build
7384 (lambda* (#:key inputs #:allow-other-keys)
7385 (substitute* "scripts/check-reallocarray.sh"
7386 (("/bin/rm" rm)
7387 (string-append (assoc-ref inputs "coreutils") rm)))
7388 (chdir "src")
7389 #t)))))
7390 (home-page "https://github.com/libbpf/libbpf")
7391 (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
7392 (description
7393 "Libbpf supports building BPF CO-RE-enabled applications, which, in
7394 contrast to BCC, do not require the Clang/LLVM runtime or linux kernel
7395 headers.")
7396 (license `(,license:lgpl2.1 ,license:bsd-2))))
7397
7398 (define-public bcc
7399 (package
7400 (name "bcc")
7401 (version "0.15.0")
7402 (source
7403 (origin
7404 (method git-fetch)
7405 (uri (git-reference
7406 (url "https://github.com/iovisor/bcc")
7407 (commit (string-append "v" version))))
7408 (file-name (git-file-name name version))
7409 (sha256
7410 (base32
7411 "1d5j9zanffa1c7lpi5fcrdlx1n7hy86xl82fam2xqr0s41q4ipxw"))))
7412 (build-system cmake-build-system)
7413 (native-inputs
7414 `(("bison" ,bison)
7415 ("flex" ,flex)))
7416 (inputs
7417 `(("clang-toolchain" ,clang-toolchain)
7418 ("libbpf" ,(package-source libbpf))
7419 ;; LibElf required but libelf does not contain
7420 ;; archives, only object files.
7421 ;; https://github.com/iovisor/bcc/issues/504
7422 ("elfutils" ,elfutils)
7423 ("linux-libre-headers" ,linux-libre-headers)
7424 ("luajit" ,luajit)
7425 ("python-wrapper" ,python-wrapper)))
7426 (arguments
7427 `(;; Tests all require root permissions and a "standard" file hierarchy.
7428 #:tests? #f
7429 #:configure-flags
7430 (let ((revision ,version))
7431 `(,(string-append "-DREVISION=" revision)))
7432 #:phases
7433 (modify-phases %standard-phases
7434 ;; FIXME: Use "-DCMAKE_USE_LIBBPF_PACKAGE=ON".
7435 (add-after 'unpack 'copy-libbpf
7436 (lambda* (#:key inputs #:allow-other-keys)
7437 (delete-file-recursively "src/cc/libbpf")
7438 (copy-recursively
7439 (assoc-ref inputs "libbpf") "src/cc/libbpf")))
7440 (add-after 'copy-libbpf 'substitute-libbc
7441 (lambda* (#:key outputs #:allow-other-keys)
7442 (substitute* "src/python/bcc/libbcc.py"
7443 (("(libbcc\\.so.*)\\b" _ libbcc)
7444 (string-append
7445 (assoc-ref outputs "out") "/lib/" libbcc)))))
7446 (add-after 'install 'wrap-tools
7447 (lambda* (#:key outputs #:allow-other-keys)
7448 (use-modules (ice-9 textual-ports))
7449 (let* ((out (assoc-ref outputs "out"))
7450 (lib (string-append out "/lib"))
7451 (tools (string-append out "/share/bcc/tools"))
7452 (python-executable?
7453 (lambda (filename _)
7454 (call-with-input-file filename
7455 (lambda (port)
7456 (string-contains (get-line port)
7457 "/bin/python"))))))
7458 (for-each
7459 (lambda (python-executable)
7460 (format #t "Wrapping: ~A.~%" python-executable)
7461 (wrap-program python-executable
7462 `("PYTHONPATH" ":" prefix
7463 (,(string-append lib
7464 "/python"
7465 ,(version-major+minor
7466 (package-version python))
7467 "/site-packages")))))
7468 (find-files tools python-executable?))
7469 #t))))))
7470 (home-page "https://github.com/iovisor/bcc")
7471 (synopsis "Tools for BPF on Linux")
7472 (description
7473 "BCC is a toolkit for creating efficient kernel tracing and manipulation
7474 programs, and includes several useful tools and examples. It makes use of
7475 extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
7476 that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
7477 and above.")
7478 (license license:asl2.0)))
7479
7480 (define-public bpftrace
7481 (package
7482 (name "bpftrace")
7483 (version "0.10.0")
7484 (source
7485 (origin
7486 (method git-fetch)
7487 (uri (git-reference
7488 (url "https://github.com/iovisor/bpftrace")
7489 (commit (string-append "v" version))))
7490 (file-name (git-file-name name version))
7491 (sha256
7492 (base32
7493 "023ardywbw5w8815j2ny9rrp2xlpxndqaa7v2njjm8109p7ilsdn"))
7494 (patches (search-patches "bpftrace-disable-bfd-disasm.patch"))))
7495 (build-system cmake-build-system)
7496 (native-inputs
7497 `(("bison" ,bison)
7498 ("flex" ,flex)))
7499 (inputs
7500 `(("bcc" ,bcc)
7501 ("clang-toolchain" ,clang-toolchain)
7502 ("elfutils" ,elfutils)
7503 ("libbpf" ,libbpf)
7504 ("linux-libre-headers" ,linux-libre-headers)))
7505 (arguments
7506 `(#:tests? #f ;Tests require googletest sources.
7507 #:configure-flags
7508 '("-DBUILD_TESTING=OFF"
7509 ;; FIXME: libbfd misses some link dependencies, when fixed, remove
7510 ;; the associated patch.
7511 "-DHAVE_BFD_DISASM=OFF")))
7512 (home-page "https://github.com/iovisor/bpftrace")
7513 (synopsis "High-level tracing language for Linux eBPF")
7514 (description
7515 "bpftrace is a high-level tracing language for Linux enhanced Berkeley
7516 Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
7517 LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
7518 interacting with the Linux BPF system, as well as existing Linux tracing
7519 capabilities: kernel dynamic tracing (kprobes), user-level dynamic
7520 tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
7521 and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
7522 created by Alastair Robertson.")
7523 (license license:asl2.0)))